Harden CSP and add CSP smoke regression checks#383
Merged
tracygardner merged 3 commits intomainfrom Mar 14, 2026
Merged
Conversation
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.
Motivation
Description
index.htmlwith explicit directives forscript-src,connect-src,img-src,worker-src,media-src,frame-src, and related directives to permit required external origins (Google Analytics / GTM andunpkg.com).CSP_POLICYand wiring it intoserver.headersandpreview.headersinvite.config.mjswhile keeping the meta tag as fallback.docs/CSP_POLICY.mddocumenting the observed runtime source inventory, per-origin rationale, the full policy, and regression expectations.scripts/csp-smoke.mjsand an npm scripttest:csp-smoketo exercise core flows (app load, Blockly interaction, project import/export, sandboxed execution, analytics path) and fail onsecuritypolicyviolationevents, and updateREADME.mdandCONTRIBUTING.mdto reference the new checks.Testing
npm run build, which completed successfully (Vite warnings non-blocking); build artifacts generated as expected.npm run test:csp-smokein this environment, but Playwright browser installation failed due to upstream download (Playwright Chromium download returned HTTP 403), so the headless-run smoke script could not complete here.https://unpkg.comwhere required) produced no observedsecuritypolicyviolationevents and produced a runtime source inventory which is recorded indocs/CSP_POLICY.md.scripts/csp-smoke.mjswhich writesartifacts/csp-smoke-summary.jsonfor CI use and will fail CI if violations or missing analytics path are detected (CI should runnpx playwright installbeforenpm run test:csp-smoke).Codex Task