Repository navigation
test: serve the self-signed certificate locally in content specs - #5656
Merged
Merged
Conversation
The "can accept insecure certs" test in the chromium, chrome and edge content specs navigated to https://self-signed.badssl.com, which intermittently resets connections and failed the suite for reasons unrelated to the code under test. Each run now starts a local HTTPS server with a throwaway certificate generated by openssl into a temporary directory that is removed when the server closes; nothing is checked in. The test also asserts that the same page is rejected without acceptInsecureCerts, so the flag's effect is actually observed. Co-authored-by: Amp <[email protected]>
The key and certificate are read into memory and the temporary directory is removed in a finally block, so a failing openssl run or readFile no longer leaves files behind and close() only has to shut the server down. Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-01a19e1b-2b15-7602-bca2-ef47a9e2f15e
ahmedAmien
approved these changes
Nov 3, 2026
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.
Why
The
can accept insecure certstest in the chromium, chrome and edgecontentspecs navigated tohttps://self-signed.badssl.com. That host intermittently resets connections (net::ERR_CONNECTION_RESET), which turned into 500/408 responses and failed thetest-*jobs on every retry attempt, independently of the code under test (seen onmain's release-please run on 2026-11-02 and on #5653 today).What
src/shared/tests/self-signed-server.tsstarts a local HTTPS server whose certificate is generated at test time byopenssl(already present in the base image and on macOS) into a temporary directory. The key and certificate are deleted when the server closes; nothing is committed to the repository.acceptInsecureCertsbefore asserting it is accepted (200) with the flag and that the served content came through. Previously the test would have kept passing even if the flag had no effect.Test-only change; no production code is touched.
Verification
npx mocha --no-package --no-config --timeout 45000 build/routes/{chromium,chrome,edge}/tests/content.spec.js: 46 passing on Node 24.21.0, with the threecan accept insecure certscases at ~1.7 s each.browserless-self-signed-*directories remain in the OS temp directory after the run.prettier --checkandeslintclean on the changed files;tscbuilds.Summary by CodeRabbit