Repository navigation
Commit the CSP Browser Trial as a Repeatable Check - #519
Conversation
The blog policy shipped after a headless Chromium pass that no committed tool could repeat. check-csp-browser.py loads every rendered page of a running mirror in the Playwright image checks/browser/Dockerfile pins, and fails on any securitypolicyviolation that csp-browser-allow.txt does not list. The Playwright package is installed at the image tag's version, so Dependabot moves one pin. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #519 +/- ##
===========================================
+ Coverage 50.92% 52.24% +1.31%
===========================================
Files 11 12 +1
Lines 3173 3319 +146
===========================================
+ Hits 1616 1734 +118
- Misses 1557 1585 +28
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 probe runner lets a timeout or a missing docker binary escape as a traceback instead of the intended FAIL: refusal, which needs a fix before merge.
2 open issues
What changed in this PR
This PR turns a one-off headless Chromium pass into a repeatable check, checks/check-csp-browser.py. The check loads each page of a running mirror in a Playwright container. It scrolls each page, clicks the code-copy buttons, and types a search query. It then reports every Content-Security-Policy violation the browser records. A run fails on any violation not listed in checks/csp-browser-allow.txt, or on any page that does not return 200. The Playwright image pin lives in checks/browser/Dockerfile, and Dependabot tracks it. The docs say when to run the check, which is by hand against the local mirrors.
Changes:
- Adds the browser check: a host half that starts the container and folds its output into findings, and a probe half that runs inside the container.
- Adds an allow list with the two dead hotlinked image origins from issue #513, and a Dependabot entry that tracks the browser image pin.
- Documents the check in OPERATIONS.md, deploy/README.md, and checks/README.md, and adds unit tests for the host half.
| File | Description |
|---|---|
| OPERATIONS.md | Documents when the browser check runs (CSP or layout changes), how to run it, and its rules. |
| deploy/README.md | Adds the new tools (uv, Docker use) to the tool table and links the check from the CSP section. |
| checks/tests/test_check_csp_browser.py | Unit tests for the host half: pin parsing, list reading, origin reduction, summaries, command construction, and the probe runner. |
| checks/README.md | Adds the new check to the list of checks and its link definitions. |
| checks/pyproject.toml | Corrects the header comment, which no longer says the gates are standard library only, and adds a mypy override for Playwright. |
| checks/csp-browser-allow.txt | Lists the two known dead hotlinked image origins, each with its reason. |
| checks/check-csp-browser.py | The new gate: reads the pin and the lists, runs the container, and reports violations and failed page loads. |
| checks/browser/Dockerfile | Pins the Playwright base image by version tag and digest. |
| .github/dependabot.yml | Tracks checks/browser with checks/caddy for Docker updates on both branches. |
Review effort: Lite
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
A recorded local strict-review pass covers head |


For #518.
Summary
The blog's Content-Security-Policy went live after a headless Chromium pass, but that pass was a scratch script. This commits it as
checks/check-csp-browser.py.checks/browser/Dockerfileand derives the pip version from that image's tag. It then runs the container with--network hostand the host'suvmounted, and folds the probe's JSON-line records into findings./search/. It records everysecuritypolicyviolationevent.checks/csp-browser-allow.txtdoes not list, and on any page that does not answer200. On a run over the default list it also fails on an allow entry that nothing matched. The two dead-hotlink origins from Settle the Dead Hotlinked Images on Eight Archived Posts #513 are the only entries./checks/caddyand/checks/browserthroughdirectories. The Playwright package follows the image tag, so the two cannot drift.This PR carries the
commentslabel because it edits the Dependabot header comment and thechecks/pyproject.tomlheader comment.Verification
checks/: ruff check, ruff format, and mypy are clean, and the unit suite passes. The new tests cover the host half: pin parsing, list and allow-list reading, origin reduction, summarizing,main, command construction, and the probe runner.PASSover 328 pages. The allowed blocks were 94img-srcon docs.google.com and 1 on www.elcolighting.com, which matches Settle the Dead Hotlinked Images on Eight Archived Posts #513's survey.--allow-comments, and so is its sentence-length check. markdownlint, editorconfig-checker, and cspell are clean throughdocker_lint.py.Local review
The pass ran at the frontier tier over three rounds, and the receipt covers the head.
scheme:branch. Chromium reports a non-HTTP(S)blockedURIas the bare scheme, so the branch could never match, and OPERATIONS.md now says how to write such an entry.#-comment skip that made this reader ofgolden-urls.txtdisagree with the other two readers.check-csp-scripts.py. The gates inchecks/are standalone and loaded by path, and after the fix above the overlap is oneurlsplitline. The reviewer accepted the decline in round 2.🤖 Generated with Claude Code