Repository navigation
Assert the Security Headers on Every Response the Live Check Reads - #504
Conversation
The live check read no security header, so a Caddyfile edit that dropped one passed every gate. Each response it already requests now carries the exact values in checks/security-headers.txt, which a unit case holds to the Caddyfile. One missing .png probes the handle_errors route, at the cost of a static request rather than a page. The preflight and the family pages also print whether the run reached the Cloudflare edge, which replaces the hand probe in OPERATIONS.md. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The preflight assertion read the dump taken before the release wait, so a release that changed a header value failed against the previous config. The wait now refreshes the whole dump. A same-origin redirect destination is header-checked too, one header_value reader replaces the copies, and the Caddyfile test reads a bare value as well as a quoted one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A media hop to another host is no longer held to this site's list, a
repeated header reads as its first instance on both read paths, as curl's
%header{} does, and a matcher-scoped security header in the Caddyfile
fails the sync test rather than being demanded on every response. The
curl row in deploy/README.md names the 7.84 floor %header{} needs.
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✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #504 +/- ##
========================================
Coverage 49.70% 49.70%
========================================
Files 10 10
Lines 3058 3058
========================================
Hits 1520 1520
Misses 1538 1538
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 Caddyfile parity test does not safely reject path- or block-scoped header directives, and the printed sample omits the 404 probe.
1 open issue
What changed in this PR
This pull request strengthens the live URL check by validating exact security headers across blog, family, redirect, media, and 404 responses, while synchronizing expected values with the Caddyfile.
Changes:
- Adds shared security-header expectations and Caddyfile synchronization tests.
- Extends
check-live-urls.shwith header validation, a missing-media 404 probe, reload-convergence handling, and proxy verdict output. - Updates operational and deployment documentation, including the curl version requirement.
| File | Description |
|---|---|
OPERATIONS.md |
Documents security-header validation, the 404 probe, and proxy verdict output. |
deploy/README.md |
Documents the curl version requirement and header-value synchronization contract. |
checks/tests/test_check_live_urls_sample.py |
Adds live-check, Caddyfile synchronization, and proxy-verdict tests. |
checks/security-headers.txt |
Defines expected security headers and exact values for both sites. |
checks/README.md |
Documents the security-header contract and missing-file coverage. |
checks/check-live-urls.sh |
Reads and validates headers across live responses and adds the 404 probe. |
Review effort: Lite
The sync case read each line alone, so a path matcher was skipped and a header inside a matcher-scoped block read as site-wide, and it reached only an allowlist of names. It now tokenizes each line, tracks the block a header sits in, reads every header a site sets on all responses apart from its cache headers and markers, and refuses any other header scoped to fewer responses. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Each review round found another directive form the hand-written reader misread: path matchers, matcher-scoped blocks, status requirements, scoped deletions. The sync case now runs caddy adapt in a pinned image, offline, and walks the JSON, where a matcher, a require, an error route, or a delete is explicit. Dependabot tracks the image pin. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A header in one of several mutually exclusive handle routes, or behind a handler that answers first, read as site-wide. Both now count as scoped. An error route repeating a value every response already carries is no longer refused. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
A recorded local strict-review pass covers head |
A deferred header write misses error responses, so it now counts as scoped. A header after encode, rewrite, or templates still reaches every response, and an error route with its own matcher that repeats a site-wide value narrows nothing, so neither is refused any longer. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Removing a header the site never sets on every response, such as Server, narrows nothing the live check asserts, so the sync case no longer refuses it. Deleting a site-wide security header on some responses is still refused, in the main routes and in an error route. Co-Authored-By: Claude Opus 5.5 <[email protected]>
--print-sample counted the probe in its static budget without listing it, so the listing and the budget could not be reconciled. It is now a plan row like any other request. A failed build of the Caddy image reports Docker's own output rather than a bare exit status. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
A recorded local strict-review pass covers head |
The 404 probe repeated check_render step for step. Both now call check_status with a label, the expected status, and the URL. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
A recorded local strict-review pass covers head |

Summary
Works issue #500.
checks/check-live-urls.shassertedX-Blog-EnvandX-Blog-Releaseand no security header, so a Caddyfile edit that dropped one passed every gate.The issue's two design questions were answered in session:
%header{}at no extra request: the preflight, each render page, redirect, followed same-origin destination, and media file, plus each family page. One404probe is added, a missing/media/live-check-missing.png, since the404answers fromhandle_errorsrather than the main route. It counts as a static request (5 of 8) and takes no page path, so the sampled run stays at 30 of 30 pages.checks/security-headers.txt, and a unit case holds them equal todeploy/Caddyfilein both directions. That case reads the Caddyfile throughcaddy adapt, in the imagechecks/caddy/Dockerfilepins, run with networking off. A security header that a matcher, a status requirement, an error route, a deletion, a route group, or an earlier responder narrows is refused. Dependabot's newdockerentries track the image pin on both branches.The issue's comment is folded in too. The check prints
<host> proxiedor<host> UNCONFIRMEDfor the base host after its preflight and for the family host after its pages, and the hand probe in OPERATIONS.md "Deploying" is replaced by a pointer to that line.Other changes:
EXPECT_RELEASEwait refreshes the whole preflight dump, so the headers are asserted on the converged config rather than the pre-reload one.header_valuereader replaces the inlinegrep | tr | sedcopies.deploy/README.mdnames the curl 7.84 floor%header{}needs. The ubuntu-24.04 runner has 8.5.Verification
python3 -m unittest discover -s checks/tests: the whole suite passes. New cases cover the Caddyfile sync throughcaddy adaptwith each narrowing shape both ways, a missing header on each response kind and on a family page, a weakened HSTS value, a followed destination, a reload that converges after a stale first answer, and the proxied verdict both ways. Each new live-check case was shown failing with the check mutated out or against the pre-fix script.PASS - 1295 URLs honored, both hostsUNCONFIRMEDas expected for a DNS-only mirror.--strict, pyright, markdownlint, and the prose gate (--allow-comments, plussentence-length) are clean on the diff. The added comments each carry a reason, so this PR carries thecommentslabel.Local strict review
Frontier-tier passes ran before each push. They fixed the pre-reload preflight dump, the duplicate header reader, the unchecked followed destination, an off-site media hop, the two read paths disagreeing on a repeated header, and the missing curl floor. The Caddyfile reader went through a line regex and a nesting-aware tokenizer before the maintainer chose Caddy's own parser in a container, which also closes the review thread on path- and block-scoped directives. Every finding an earlier version of this body listed as open is fixed on the branch: deferred writes count as scoped,
encode,rewrite, andtemplatespass through, and a matched error route repeating a site-wide value is accepted. A deletion of an unasserted header such as-Serveris no longer refused. The 404 probe is listed by--print-sample, a failed image build reports Docker's error, and the 404 probe and the render check share onecheck_statushelper. The final pass over the head raised no findings.Declined with evidence
%header{}printed only the first copy when curl 8.14 was sent two differing copies, which matches the dump reader'shead -n 1, so both paths give one verdict.deploy/README.mdstates the floor.Dropped findings
checks/tests/test_check_live_urls_sample.pytest_each_redirect_destination_is_a_fixed_caddyfile_target, consolidation on text this change did not touch: it still reads redirects with a regex whereadaptcould supply them.🤖 Generated with Claude Code