You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Promote the Blog Content-Security-Policy to Main - #516
Enforce a Blog Content-Security-Policy Behind a Script Hash Gate #514 makes the blog site block send an enforcing Content-Security-Policy. Its script-src lists hashes of the theme's four inline scripts. checks/check-csp-scripts.py runs in the release build and fails when the hashes and the built scripts differ. It also deletes the unused Google Maps shortcode, whose frame the policy would block.
This changes what the server sends, so the release needs a deploy to each site. Local staging has served the enforcing policy since 83a8e8c. A headless Chromium pass there over every rendered URL recorded no violation other than the 95 dead hotlinked images #513 tracks.
* Trial a Blog Content-Security-Policy as Report-Only Behind a Hash Gate
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Enforce the Blog Content-Security-Policy and Test Its Hash Gate
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Check the Shipped Caddyfile's Policy and Name the CSP Gate in Its Docs
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Test the CSP Gate's Refusals With Constructed Policy Files
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Drop the Unused Google Maps Shortcode the Blog Policy Blocks
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Check Import Maps and Speculation Rules Against the Blog Policy
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Read Built Pages Strictly and Name the Script Host Form the Gate Reads
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Name Theme Settings Among What Changes the Blog's Inline Scripts
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Check Every Script Type a Browser Runs and Name the Proxy's Injected Scripts
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Name the CSP Gate Beside the URL Parity Check Wherever It Is Run
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
❌ Patch coverage is 83.47826% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.92%. Comparing base (b13ce30) to head (5f85875). ⚠️ Report is 145 commits behind head on main.
Promotes the blog’s enforcing Content-Security-Policy to main, with release-time validation that rendered scripts match the configured policy.
Changes:
Adds CSP headers, script-hash validation, tests, documentation, and release/editor integration.
Removes the unused Google Maps shortcode.
Updates deployment and content-verification guidance.
File
Description
themes/README.md
Documents CSP hash updates after theme changes.
README.md
Adds the CSP gate to local site verification.
layouts/shortcodes/googlemaps.html
Removes the unused Google Maps shortcode.
deploy/README.md
Documents the CSP, hash gate, and deployment implications.
deploy/make-release.sh
Runs CSP validation during release builds.
deploy/Caddyfile
Adds the enforcing blog CSP header.
CONTENT.md
Adds the CSP gate to content verification requirements.
checks/tests/test_check_csp_scripts.py
Tests script scanning and policy-loading behavior.
checks/security-headers.txt
Records the expected blog CSP value.
checks/README.md
Documents the new CSP check.
checks/check-csp-scripts.py
Validates scripts against the configured CSP; three moderate issues remain involving scheme-only URLs, unterminated scripts, and parameterized JavaScript MIME types.
…#517)
* Require a Named Scheme Before the CSP Gate Allows a Scheme Script URL
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Report a javascript: Script URL Once and Name Scheme Sources in the Gate's Wording
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Capture an Inline Body Only for a Script Without a src
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Read a Valueless src as External and Mend the Gate's Finding Wording
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Three moderate CSP validation issues remain unresolved and should be fixed before approval.
No open issues 🎉
2 previously missed issues
In code that hasn't changed since last review
Parse MIME essence before checking executable script types
checks/check-csp-scripts.py:95
[bug] Parse the MIME type essence before checking SCRIPT_TYPES. A valid executable tag such as <script type="text/javascript; charset=utf-8"> is currently skipped, so the gate can pass without hashing it even though the browser executes it and the enforcing CSP blocks it. Add a regression case for a JavaScript MIME type with parameters.
Scope CSP header comparison to the blog directive
checks/check-csp-scripts.py:161
[bug] Scope this comparison to the blog's actual Caddy header directive instead of searching the whole file. If the blog header is changed or removed while the old Content-Security-Policy "..." text remains in a comment or another site block, this substring check still loads the policy and the release gate can pass with a different header being served. Add a test for that drift and parse the blog block or otherwise ignore comments and other site blocks.
Answering the two findings this round raised outside a thread.
Parse MIME essence before checking executable script types (checks/check-csp-scripts.py:95). A valid executable tag [with a JavaScript MIME type carrying parameters] is currently skipped.
Declined with evidence. The HTML standard runs a script only when its trimmed type string is an ASCII case-insensitive match for a JavaScript MIME type essence, so a value with parameters is a data block. Chromium 140 agrees, as the probe on #514 showed: text/javascript; charset=utf-8 and text/javascript;charset=utf-8 both skip, while Text/JavaScript, text/javascript, application/ecmascript, and text/javascript1.5 run. The gate checks exactly the set the browser runs: #514 (comment)
Scope CSP header comparison to the blog directive (checks/check-csp-scripts.py:161). If the blog header is changed or removed while the old text remains in a comment or another site block, this substring check still loads the policy.
Declined with evidence. That drift already fails CI. CaddyfileSyncTests.test_expected_values_are_the_caddyfile_values in checks/tests/test_check_live_urls_sample.py runs caddy adapt on deploy/Caddyfile. For each site it compares the headers Caddy sends on every response with security-headers.txt. Caddy's parser drops comments and keeps each site block's headers apart, so a changed or removed blog header fails that test whatever text remains elsewhere. The unit test job runs it on every pull request. The substring check in the gate catches a split between the two files at release time. It does not have to repeat what the sync test proves.
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
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.
Summary
This promotes
developtomain:Content-Security-Policy. Itsscript-srclists hashes of the theme's four inline scripts.checks/check-csp-scripts.pyruns in the release build and fails when the hashes and the built scripts differ. It also deletes the unused Google Maps shortcode, whose frame the policy would block.data:orblob:inscript-srcbefore it allows a script from that scheme, rather than reading it as'self'.This changes what the server sends, so the release needs a deploy to each site. Local staging has served the enforcing policy since 83a8e8c. A headless Chromium pass there over every rendered URL recorded no violation other than the 95 dead hotlinked images #513 tracks.
Closes #501
🤖 Generated with Claude Code