Skip to content

[Networking] Set curl.cainfo alongside openssl.cafile - #3583

Merged
adamziel merged 2 commits into
trunkfrom
adamziel/curl-cainfo
May 1, 2026
Merged

[Networking] Set curl.cainfo alongside openssl.cafile#3583
adamziel merged 2 commits into
trunkfrom
adamziel/curl-cainfo

Conversation

@adamziel

@adamziel adamziel commented May 1, 2026

Copy link
Copy Markdown
Collaborator

PHP's openssl.cafile only governs OpenSSL streams (fopen, file_get_contents over HTTPS). libcurl reads its CA bundle from curl.cainfo. We were configuring the former in every entry point but not the latter, so curl_exec() against HTTPS URLs fell back to whatever bundle libcurl happened to be compiled with — on the WASM build, that's nothing useful.

This wires curl.cainfo to the same ca-bundle.crt we already write for OpenSSL in php-wasm-cli, the remote iframe, and both Blueprints v1 and v2 CLI workers.

Tests

  • Web: new HTTPS curl test in packages/php-wasm/web/src/test/php-networking.spec.ts that writes the tcp-over-fetch CA to /internal/shared/ca-bundle.crt, sets both ini entries, and curls https://api.wordpress.org/stats/php/1.0/.
  • CLI: new curl_test.php smoke test that curls the same HTTPS endpoint via npx nx dev php-wasm-cli.
PHP's openssl.cafile only governs OpenSSL streams (fopen, file_get_contents
over https). libcurl reads its CA bundle from curl.cainfo. We were configuring
the former in every entry point but not the latter, so curl_exec() against
HTTPS urls fell back to whatever bundle libcurl happened to be compiled with —
on the WASM build, that's nothing useful.

This wires curl.cainfo to the same ca-bundle.crt we already write for OpenSSL
in php-wasm-cli, the remote iframe, and both Blueprints v1 and v2 CLI workers,
and adds smoke tests that exercise curl over HTTPS in the web runtime and the
CLI so the two ini entries stay in sync going forward.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Wires PHP’s libcurl CA bundle configuration (curl.cainfo) to the same CA bundle already used for OpenSSL streams (openssl.cafile) so HTTPS verification works consistently across entry points (notably in WASM builds).

Changes:

  • Set curl.cainfo alongside openssl.cafile in remote worker and Blueprint v1/v2 CLI workers.
  • Update php-wasm CLI to pass curl.cainfo via -d at startup.
  • Add web + CLI smoke tests to verify HTTPS curl requests succeed with the configured CA bundle.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/playground/remote/src/lib/playground-worker-endpoint.ts Adds curl.cainfo ini entry to match existing CA bundle path.
packages/playground/cli/src/blueprints-v2/worker-thread-v2.ts Adds curl.cainfo in Blueprint v2 worker ini configuration.
packages/playground/cli/src/blueprints-v1/worker-thread-v1.ts Adds curl.cainfo in Blueprint v1 worker ini configuration.
packages/php-wasm/web/src/test/playwright/browser-globals.ts Exposes certificateToPEM to browser-side tests.
packages/php-wasm/web/src/test/php-networking.spec.ts Adds a curl-over-HTTPS verification test using curl.cainfo.
packages/php-wasm/web/src/lib/tcp-over-fetch-websocket.ts Updates docs comment to mention curl.cainfo alongside openssl.cafile.
packages/php-wasm/cli/tests/smoke-test.sh Extends CLI smoke test to run a curl HTTPS verification test.
packages/php-wasm/cli/tests/curl_test.php New CLI curl HTTPS smoke test script.
packages/php-wasm/cli/src/main.ts Passes curl.cainfo (and openssl.cafile) via CLI -d flags.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/php-wasm/web/src/test/php-networking.spec.ts
Comment thread packages/php-wasm/web/src/test/php-networking.spec.ts
Comment thread packages/php-wasm/web/src/test/php-networking.spec.ts
Comment thread packages/php-wasm/cli/tests/smoke-test.sh
@github-actions github-actions Bot added the [Type] Documentation Improvements or additions to documentation label May 1, 2026
@adamziel adamziel changed the title Set curl.cainfo alongside openssl.cafile May 1, 2026
@adamziel adamziel changed the title [SSL] Set curl.cainfo alongside openssl.cafile May 1, 2026
@adamziel adamziel added the [Type] Enhancement New feature or request label May 1, 2026
@adamziel
adamziel merged commit 24784f8 into trunk May 1, 2026
48 of 50 checks passed
@adamziel
adamziel deleted the adamziel/curl-cainfo branch May 1, 2026 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment