Repository navigation
Read CSP Violations From Every Frame in the Browser Trial - #522
Conversation
The probe read the violation buffer from the top frame only, so a resource blocked inside an iframe never reached the report. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
|
A recorded local strict-review pass covers head |
There was a problem hiding this comment.
🟡 Changes recommended
Violations from transient frames can still be silently omitted before collection.
1 open issue
What changed in this PR
This pull request updates the CSP browser trial to collect violations from the main document and every currently attached frame, and documents the expanded coverage.
Changes:
- Read
window.__cspfrom each frame inpage.frames. - Update the probe documentation and local verification instructions.
- Address transient-frame handling before approval.
| File | Reviewed change |
|---|---|
OPERATIONS.md |
Documents frame-aware CSP violation collection during local verification. |
checks/check-csp-browser.py |
Collects CSP violations from each attached frame. Finding: violations from frames that navigate or detach before collection may be lost (moderate, 2 votes). |
Review effort: Lite
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #522 +/- ##
===========================================
- Coverage 52.44% 52.39% -0.05%
===========================================
Files 12 12
Lines 3333 3336 +3
===========================================
Hits 1748 1748
- Misses 1585 1588 +3
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:
|
A frame that detached or navigated before the read lost its buffered violations. A context binding now carries each event to the probe the moment it fires. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
A recorded local strict-review pass covers head |

Summary
This answers promotion #521's review. The browser probe installs its
securitypolicyviolationlistener throughcontext.add_init_script, which runs in every frame, but it then readwindow.__cspfrom the main frame only. A resource blocked inside an iframe therefore never reached the report, and the check could pass while missing it. The probe now readswindow.__csp || []in each entry ofpage.frames. The docstring and OPERATIONS.md "Local Verification" say so.Verification
default-src 'self'; img-src 'self'on a page holding a same-origin iframe, and the child page loads an image from another host.PASS, which is the miss.frame-srcblocks added, it failed on both.img-srccame from the child frame andframe-srcfrom the parent. Evaluating in the blocked frame did not throw.checks/unit suite passes, and ruff and mypy are clean. The probe half runs only in the container, so the mock run is its evidence.Local review
One frontier-tier pass, with no findings. It checked for double counting (each violation fires in exactly one document's buffer) and for a frame that throws on
evaluate(that run fails loudly, and the site carries no frames today).🤖 Generated with Claude Code