Skip to content

test(csp): also guard against trailing bare https: source#275

Open
dormouse-bot wants to merge 1 commit into
mainfrom
test/csp-https-scheme-guard
Open

test(csp): also guard against trailing bare https: source#275
dormouse-bot wants to merge 1 commit into
mainfrom
test/csp-https-scheme-guard

Conversation

@dormouse-bot

Copy link
Copy Markdown
Collaborator

Surfaced by the nightly code-quality survey.

The "secure by default" CSP test asserts that connect-src carries no scheme-wide https:/wss: source (which would let the webview reach an arbitrary internet host). The wss: guard checks both placements — mid-directive (' wss: ') and end-of-directive (' wss:;') — but the parallel https: guard only checked the mid-directive form. A bare https:; at the end of the connect-src directive — exactly where wss://*.dormouse.sh; currently sits — would have slipped through, contradicting the test's stated intent.

This mirrors the wss: guard onto the https: check so both scheme-wide forms are caught in either position.

Test-only robustness fix — no product code changes. The existing four csp.test.mjs cases still pass (the shipped CSP has no bare https: in either form); this closes the gap so a future regression that introduced a trailing https:; would be caught.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 20, 2026

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 835425c
Status: ✅  Deploy successful!
Preview URL: https://d99ea8d6.mouseterm.pages.dev
Branch Preview URL: https://test-csp-https-scheme-guard.mouseterm.pages.dev

View logs

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.

1 participant