Skip to content

Promote the Security Header Assertions in the Live Check - #505

Merged
ptr727 merged 3 commits into
mainfrom
develop
Oct 24, 2026
Merged

ptr727 merged 3 commits into
mainfrom
develop

Conversation

@ptr727

@ptr727 ptr727 commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

Summary

Promotes #504, #506, and #507 to main. #506 answers this pull request's first review round: the reload wait rechecks the preflight status, and three doc sentences are tidied. #507 answers the second: the family site's 404 is probed for its headers too.

  • checks/check-live-urls.sh asserts the exact security headers in checks/security-headers.txt on every response it already requests, including followed same-origin destinations. A 404 probe on each site covers its handle_errors block without growing the page budget.
  • The check prints <host> proxied or <host> UNCONFIRMED for each host, replacing the hand probe in OPERATIONS.md "Deploying".
  • A unit case holds security-headers.txt to deploy/Caddyfile through caddy adapt, in a Caddy image checks/caddy/Dockerfile pins. Dependabot's new docker entries track that pin once this reaches main.

No site content or served config changes. After merge, the release's VPS deploys run the new check against staging and production.

Closes #500

🤖 Generated with Claude Code

)

* Assert the Security Headers on Every Response the Live Check Reads

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]>

* Read the Headers After the Reload and on Followed Destinations

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]>

* Keep the Header Assertions to This Site's Responses

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]>

* Follow Block Nesting When Reading the Caddyfile's Headers

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]>

* Read the Caddyfile's Headers Through Caddy's Own Parser

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]>

* Treat Grouped Routes and Earlier Responders as Narrowing a Header

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]>

* Read Deferred Writes, Pass-Through Handlers, and Matched Error Routes

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]>

* Count a Header Deletion Only Where It Removes an Asserted Header

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]>

* List the 404 Probe in the Sample Plan and Keep the Build's Error

--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]>

* Share One Status and Header Check Between Pages and the 404 Probe

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]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings October 24, 2026 19:54
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: aea06258-2ba5-418a-9c3f-c4e313d1029a
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.70%. Comparing base (64b8793) to head (2ada144).
⚠️ Report is 141 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #505   +/-   ##
=======================================
  Coverage   49.70%   49.70%           
=======================================
  Files          10       10           
  Lines        3058     3058           
=======================================
  Hits         1520     1520           
  Misses       1538     1538           
Flag Coverage Δ
python-3.13 49.70% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The live-check preflight has a status-validation defect, and the Caddy test invocation currently fails due to a duplicated entrypoint.

1 open issue
What changed in this PR

This pull request promotes exact security-header assertions into the live URL check and adds Caddy configuration parity tests, documentation, and Dependabot tracking.

Changes:

  • Validates expected security headers across normal, redirected, followed, media, and 404 responses.
  • Adds pinned Caddy-based configuration synchronization tests.
  • Updates operational and deployment documentation with the new checks and requirements.
  • Adds Docker dependency tracking for the pinned Caddy image.

Review findings:

  • checks/check-live-urls.sh: The refreshed preflight must preserve and revalidate the response status after reload convergence. Moderate
  • checks/tests/test_check_live_urls_sample.py: The Docker invocation must avoid duplicating the image’s caddy entrypoint. Critical
  • OPERATIONS.md and checks/README.md: Minor grammar corrections are needed. Nits
File Description
OPERATIONS.md Documents the additional missing-file check, security-header requirements, and proxy verdict output.
deploy/​README.md Documents the curl version floor and security-header synchronization contract.
checks/​tests/​test_check_live_urls_sample.py Tests header assertions, proxy detection, reload convergence, sampling, and Caddyfile parity.
checks/​security-headers.txt Defines the expected security headers and exact values for both sites.
checks/​README.md Explains the security-header contract, 404 coverage, and Docker-based Caddy parsing.
checks/​check-live-urls.sh Reads and validates security headers across live-check responses and adds the missing-file probe.
checks/​caddy/​Dockerfile Pins the Caddy image used by the configuration tests.
.github/​dependabot.yml Adds Docker dependency tracking for the pinned Caddy image on both branches.

Review effort: Lite

The reload wait refreshed the preflight dump but kept the first status,
so a reload that converged on an error passed the preflight. The refresh
reads the status too, and a converged answer other than 200 fails. Also
tidies three sentences in OPERATIONS.md and checks/README.md.

Co-authored-by: Claude Opus 5.5 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The family error route lacks coverage for its security headers, leaving a moderate unresolved regression risk.

No open issues 🎉

1 resolved since last review

Review effort: Lite

The family site answers its 404 from a handle_errors block of its own,
and the live check probed only the blog's. A missing .png on the family
host now has to answer 404 with the family's headers, at the cost of one
more static request in the sampled run.

Co-authored-by: Claude Opus 5.5 <[email protected]>
@ptr727

ptr727 commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

The headline of the round on df563c4, "The family error route lacks coverage for its security headers", is fixed by #507, now merged into develop as 2ada144. The live check requests a missing file on the family host and requires a 404 carrying the family's four security headers, Content-Security-Policy included.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The changes modify live deployment verification across multiple response paths and require final human review despite having no recorded findings.

No open issues 🎉

Review effort: Lite

@ptr727

ptr727 commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

The headline of the round on 2ada144, "require final human review despite having no recorded findings", names no defect. It asks for the maintainer's review, which is the merge decision this promotion is waiting on. Verification behind it: the whole checks/tests suite passes, the full contract passes against the local staging mirror on both sites, and each feature pull request carried a frontier-tier local pass with no open findings.

@ptr727
ptr727 merged commit 32d01ff into main Oct 24, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assert the Security Headers in the Live Check

2 participants