Repository navigation
Match the committed HSTS max-age to what the edge serves - #42
Conversation
Zone-wide HSTS is now enabled so the Worker's /api/* responses carry the header too, but Cloudflare's longest max-age option is 12 months and the zone setting overrides this file. The committed 63072000 was therefore never what visitors received; lower it to the 31536000 actually served so the file is honest about production. The header test already asserts a one-year floor, so it covers this value unchanged. Records the zone-wide enablement and the decision not to submit the apex to hstspreload.org in the scan report. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
There was a problem hiding this comment.
Pull request overview
Aligns the repository’s committed HSTS policy with what production actually serves now that zone-wide HSTS is enabled in Cloudflare, and documents the operational/security rationale in the security scan report.
Changes:
- Update
public/_headersHSTSmax-agefrom 2 years (63072000) to 1 year (31536000) to match Cloudflare’s zone-wide setting. - Add an explanatory comment in
_headersdescribing why a longer committed value would be overridden anyway. - Expand
docs/securityscan.mdto record the follow-up decision: zone-wide HSTS enabled and HSTS preloading deliberately declined, while keeping thepreloadtoken to match the zone setting.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| public/_headers | Lowers committed HSTS max-age to match the Cloudflare edge value and documents the override rationale inline. |
| docs/securityscan.md | Records the follow-up outcome for the HSTS finding (zone-wide enablement, max-age alignment, and preload decision). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Follow-up to #41. Zone-wide HSTS is now enabled in Cloudflare (SSL/TLS → Edge Certificates:
includeSubDomains,preload, 12 months), so the Worker's/api/*responses carry the header too — verified live on bothhttps://pegma.dev/andhttps://pegma.dev/api/health.That surfaced a mismatch. Cloudflare's longest
max-ageoption is 12 months and the zone setting overridespublic/_headers, so the committed63072000(2 years) was never what visitors actually received. This lowers it to the31536000the edge serves, so the committed header is honest about production, and adds a comment recording why a longer value here would be pointless.src/security-headers.test.tsalready asserts a one-year floor rather than an exact value, so it covers the new value unchanged.Preloading: deliberately declined
The apex was not submitted to hstspreload.org. That site now states plainly that "HSTS preloading is not recommended" — Chrome and Safari already upgrade all HTTP navigations to HTTPS regardless of HSTS policy, so preloading only helps when that upgrade fails against an active on-path attacker, while list entries are hardcoded into Chrome and take months to add or remove. The domain does meet all four submission requirements (valid certificate,
http://pegma.dev→ 301 → HTTPS,wwwserves HTTPS, and the header carriesmax-age≥ 31536000 withincludeSubDomainsandpreload) should that trade ever look worthwhile. Thepreloadtoken stays to match the zone setting; it is inert without a list submission.Both changes are recorded against the HSTS finding in
docs/securityscan.md.Verification
npm run check— cleannpm test— 191 tests passing (node) + D1 suite passingnpm run build— 11 pages built🤖 Generated with Claude Code