Skip to content

test: serve the self-signed certificate locally in content specs - #5656

Merged
ahmedAmien merged 2 commits into
mainfrom
test/self-signed-local-server
Nov 3, 2026
Merged

ahmedAmien merged 2 commits into
mainfrom
test/self-signed-local-server

Conversation

@artiom

@artiom artiom commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Why

The can accept insecure certs test in the chromium, chrome and edge content specs navigated to https://self-signed.badssl.com. That host intermittently resets connections (net::ERR_CONNECTION_RESET), which turned into 500/408 responses and failed the test-* jobs on every retry attempt, independently of the code under test (seen on main's release-please run on 2026-11-02 and on #5653 today).

What

  • src/shared/tests/self-signed-server.ts starts a local HTTPS server whose certificate is generated at test time by openssl (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.
  • The three specs navigate to that server instead of badssl.com, and now also assert that the same page is rejected (500) without acceptInsecureCerts before 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 three can accept insecure certs cases at ~1.7 s each.
  • No browserless-self-signed-* directories remain in the OS temp directory after the run.
  • prettier --check and eslint clean on the changed files; tsc builds.

Devin Review

Summary by CodeRabbit

  • Tests
    • Expanded coverage across Chrome, Chromium, and Edge for HTTPS sites using self-signed certificates. Tests confirm that requests fail by default and succeed when insecure-certificate acceptance is enabled.

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]>
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

The Chrome, Chromium, and Edge route tests use a local self-signed HTTPS endpoint. They check requests with and without acceptInsecureCerts. A shared helper starts the server and cleans up its resources.

Changes

Self-Signed Certificate Tests

Layer / File(s) Summary
Local HTTPS test server
src/shared/tests/self-signed-server.ts
Adds a helper that generates a self-signed certificate, starts an HTTPS server on an ephemeral port, serves a marker, and removes temporary files when closed.
Browser route certificate checks
src/routes/chrome/tests/content.spec.ts, src/routes/chromium/tests/content.spec.ts, src/routes/edge/tests/content.spec.ts
Each route test checks for status 500 without acceptInsecureCerts, then status 200 and the server marker when the option is enabled. Each test closes the server in a finally block.

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Other

Suggested reviewers: xrazik1

Merge Risk: Minimal · up to 5f3a2

The tests now use a local HTTPS endpoint. No merge-blocking risk was identified.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes the main change: replacing the remote self-signed certificate dependency with a locally served certificate in the content specs.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 4 files.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the HTTPS light
With certificates tucked in tight
No option? The request says no
With trust enabled, markers show
Then closes up the server right

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Team
  • Run ID: fd1f0eb1-e308-4919-a109-38dfe13690f1
Commits

Reviewing files that changed from the base of the PR and between e6b0b94 and 5f3a25b.

Files selected for processing: 1
  • src/shared/tests/self-signed-server.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@devin-ai-integration devin-ai-integration Bot 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  • Fix comments: Fix CodeRabbit comments on this PR

Comment thread src/shared/tests/self-signed-server.ts Resolved
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
ahmedAmien merged commit 2aa0f08 into main Nov 3, 2026
15 checks passed
@ahmedAmien
ahmedAmien deleted the test/self-signed-local-server branch November 3, 2026 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants