[Networking] Set curl.cainfo alongside openssl.cafile - #3583
Merged
Conversation
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.
Contributor
There was a problem hiding this comment.
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.cainfoalongsideopenssl.cafilein remote worker and Blueprint v1/v2 CLI workers. - Update php-wasm CLI to pass
curl.cainfovia-dat 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PHP's
openssl.cafileonly governs OpenSSL streams (fopen,file_get_contentsover HTTPS). libcurl reads its CA bundle fromcurl.cainfo. We were configuring the former in every entry point but not the latter, socurl_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.cainfoto the sameca-bundle.crtwe already write for OpenSSL in php-wasm-cli, the remote iframe, and both Blueprints v1 and v2 CLI workers.Tests
packages/php-wasm/web/src/test/php-networking.spec.tsthat writes the tcp-over-fetch CA to/internal/shared/ca-bundle.crt, sets both ini entries, and curlshttps://api.wordpress.org/stats/php/1.0/.curl_test.phpsmoke test that curls the same HTTPS endpoint vianpx nx dev php-wasm-cli.