Skip to content

Send the Same Security Headers and Image Lifetime From Both Sites - #499

Merged
ptr727 merged 5 commits into
developfrom
feature/site-posture-consistency
Oct 24, 2026
Merged

ptr727 merged 5 commits into
developfrom
feature/site-posture-consistency

Conversation

@ptr727

@ptr727 ptr727 commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

Summary

Makes the blog and family site blocks consistent in posture, per #497 and its widened scope. The blog gains the security headers the family block already sends. The family images take the blog's one-hour image class. deploy/README.md now states each difference that stays, with its reason.

Every difference, and its disposition

# Area Disposition
1 Strict-Transport-Security Aligned. The blog sends max-age=31536000, the family value, with no includeSubDomains or preload
2 X-Content-Type-Options Aligned. The blog sends nosniff
3 Referrer-Policy Aligned. The blog sends strict-origin-when-cross-origin
4 Content-Security-Policy Kept, because blog posts embed third-party content, and a policy needs a survey of what they load first. The new deploy/README.md "Security headers" section states this and lists what the family policy allows
5 Family root images (favicon.ico, apple-touch-icon.png, og-image.png) Aligned. These were no-cache through @page and now take public, max-age=3600, the blog's image class
6 Family SVGs (crest.svg, favicon.svg) Aligned. These were cached for a week and now take an hour. Nothing recorded a reason for the week, and the blog's reason for an hour applies equally
7 CSS and JS Kept, because the family site.css and site.js are not fingerprinted, so they must revalidate. "Cache lifetimes" now says so
8 Header layout in the Caddyfile Kept. Every class measured gets the same served result. The new blog headers sit in one header {} block beside the existing lines

The audit on #497 lists everything both sites already do the same way: environment and robots variables, no-cache on pages, redirects and errors, precompression, error handling, redirect codes, robots.txt and sitemaps, check coverage, logging, and zone settings. None needed a change.

OPERATIONS.md corrects the one sentence that credited the security headers to the family block alone.

Verification

  • Released 5ff25e7 to the local staging mirror. checks/check-live-urls.sh passed in full: 1294 URLs, with the family site included.
  • Read headers on every class of both sites: the blog page, a redirect, a 404, a media 404, robots.txt, root icons, /assets/, and media JPG, MOV and ZIP. On the family site: /, the 302 and 308 redirects, /en/, /af/, both 404 shapes, robots.txt, CSS, JS, both SVGs, ICO and both PNGs. Every response carries HSTS, nosniff and Referrer-Policy. Each lifetime matches the table above.
  • Under nosniff, every type served has a correct Content-Type. That covers the blog's script and stylesheet assets, index.json, the feed and sitemap, and the .mov and .zip media.
  • Ran markdownlint, editorconfig-checker, cspell, prose_lint.py --diff with sentence-length, and the checks/tests unit suite (128 tests). All clean.

The later commits change only the README and OPERATIONS.md wording, so the staging release still serves this Caddyfile.

Local review

The local strict pass ran twice. The first raised four findings:

  • Three introduced wording findings were fixed in 4b1c724: two stated counts ("both"), a CSP sentence that left out the inline-style and data: allowances, and "follows the same table".
  • One style finding, on text this change wrote, is declined. It suggested a shared Caddyfile snippet for the header lines repeated in both blocks. The Send HSTS, nosniff, and Referrer-Policy From the Blog Site Block #497 audit kept the per-block layout (disposition 8). The blocks already repeat X-Blog-Env and X-Blog-Release the same way, and X-Robots-Tag differs per site, so a snippet would hold only part of each block's headers.

The second pass found nothing.

After the Copilot round, f1c0960 and 2bc5653 give includeSubDomains and preload separate reasons and name edge HSTS as the host side's setting. Those were the round's nit, plus one introduced finding from the next local pass. That pass's other observation was that the blog CSP survey had no tracking issue. It is now #501. The final local pass found nothing.

Deferred

After release, tell the HomeAutomation-Config session so it can re-measure both names through the proxy. That step is part of the handoff, not of this PR.

🤖 Generated with Claude Code

ptr727 and others added 3 commits October 24, 2026 07:39
The blog block gains the HSTS, nosniff, and Referrer-Policy headers the
family block already sends, with the same values. The family images take
the blog's one-hour image class, replacing a week for SVGs and no-cache
for the root PNG and ICO files. deploy/README.md states each remaining
difference and its reason, the family-only CSP included.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings October 24, 2026 14:48
@ptr727

ptr727 commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 4b1c72476ad29c70be0bd1e1db5e516fab9102ed, the content this pull request carries at that commit against develop, and it recorded 0 findings.

@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: 8512e0ae-c432-46ee-8b93-8e1e460dc28d
  • 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 (f35ec08) to head (f1c0960).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #499   +/-   ##
========================================
  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.

🔵 Needs a closer look

Automated coverage for the new security headers is missing, and the HSTS documentation needs a clarification.

No open issues 🎉

What changed in this PR

This pull request aligns security headers and image-cache lifetimes between the blog and family Caddy site blocks while documenting the intentional differences that remain.

Changes:

  • Adds HSTS, nosniff, and Referrer-Policy headers to the blog site block.
  • Applies one-hour caching to family SVG, PNG, and ICO assets while retaining CSS and JavaScript revalidation.
  • Documents shared security headers, cache behavior, HSTS scope, and the family-only CSP.
  • Updates operational documentation to reflect the shared security-header posture.
File Summary Review status
OPERATIONS.md Updates the family-site deployment description to reflect shared security headers. No findings
deploy/​README.md Documents security headers, cache lifetimes, HSTS scope, and intentional site differences. Nit: explain the includeSubDomains and preload omissions separately.
deploy/​Caddyfile Adds blog security headers and aligns family image-cache rules. Moderate issue: add automated live-contract assertions for the security headers across representative responses.

Review effort: Lite

@ptr727

ptr727 commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head f1c096050d15df34cbf731624d24086ad0601dcc, the content this pull request carries at that commit against develop, and it recorded 0 findings.

@ptr727

ptr727 commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Answering the round on 4b1c724, "Automated coverage for the new security headers is missing, and the HSTS documentation needs a clarification":

  • HSTS documentation: fixed in 2bc5653. includeSubDomains and preload now each carry their own reason. f1c0960 also names edge HSTS as the host side's setting.
  • Automated coverage: deferred to Assert the Security Headers in the Live Check #500. The check needs its own design: which responses it reads within the production edge's request budget, and whether it asserts presence or exact values. For this PR, every class on both sites was read by hand on local staging, as the body lists.

@ptr727
ptr727 merged commit 3c7ba41 into develop Oct 24, 2026
12 checks passed
@ptr727
ptr727 deleted the feature/site-posture-consistency branch October 24, 2026 15:03
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.

2 participants