Repository navigation
Require a Named Scheme Before the CSP Gate Allows a Scheme Script URL - #517
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ate's Wording Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
A recorded local strict-review pass covers head |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #517 +/- ##
===========================================
+ Coverage 50.85% 50.92% +0.07%
===========================================
Files 11 11
Lines 3168 3173 +5
===========================================
+ Hits 1611 1616 +5
Misses 1557 1557
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 Changes recommended
The unresolved moderate [P1] finding and two [P2] nit findings should be addressed before approval.
2 open issues
What changed in this PR
This pull request tightens the CSP script gate so scheme-only script URLs such as data: and blob: require an explicitly named scheme source, while handling javascript: URLs and script bodies correctly.
Changes:
- Require matching scheme sources for hostless scheme URLs.
- Avoid hashing bodies when a
srcattribute is present. - Add regression tests for scheme-based and
javascript:URLs. - Document the host and scheme forms recognized by the gate.
| File | Summary |
|---|---|
deploy/README.md |
Documents the host and scheme source forms recognized by the CSP gate. |
checks/tests/test_check_csp_scripts.py |
Adds coverage for data:, blob:, and javascript: script URLs. |
checks/check-csp-scripts.py |
Updates scheme matching and script-source handling. Outstanding findings: one [P1] moderate issue with valueless src attributes (2 votes), plus two [P2] nit findings regarding wording (2 votes) and the docstring (1 vote). |
Review effort: Lite
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
A recorded local strict-review pass covers head |


Summary
This answers the Copilot finding on promotion #516.
checks/check-csp-scripts.pyjudged a script URL with a scheme and no host, such asdata:orblob:, as'self', and passed it. A browser allows such a URL only whenscript-srcnames its scheme.allowed()requires<scheme>:inscript-srcfor such a URL.javascript:script URL is reported once, as ajavascript:URL. Only a script with nosrchas its body hashed, since a browser ignores the body of one that has asrc.deploy/README.md"Security headers" name a scheme beside a host as a form the gate reads.The live policy names no scheme source, so the gate's verdict on the current build is unchanged.
Verification
data:and ablob:script URL, refused under'self'and allowed with the scheme named, and ajavascript:script URL with a body. Each fails on the code before it.python3 -m unittest discover -s checks/testspasses. ruff, mypy, pyright, and prose lint with sentence length are clean. The gate passes on a minified build ofdevelop.Declined findings
Data:, or a barehttps:scheme source fails the gate although a browser allows it. The failure is loud, it is on a file the maintainer writes, anddeploy/README.mdnames the forms the gate reads.🤖 Generated with Claude Code