Skip to content

feat(v3.16.0): security headers + Pages-demo retire + audit doc#84

Merged
vnykmshr merged 3 commits into
mainfrom
feat/v3.16.0
May 18, 2026
Merged

feat(v3.16.0): security headers + Pages-demo retire + audit doc#84
vnykmshr merged 3 commits into
mainfrom
feat/v3.16.0

Conversation

@vnykmshr
Copy link
Copy Markdown
Collaborator

Summary

  • Security middleware adds CSP (enforcing, SHA-256 hash for the FOUC inline script), HSTS (max-age=31536000; includeSubDomains, no preload), Permissions-Policy (9-feature deny incl. FLoC opt-out), and a CSP_DISABLE env var for operators behind edge proxies. Drops deprecated X-XSS-Protection.
  • README points "Live install" at https://log.1mb.dev — the current 1mb-dev.github.io/markgo Pages serve is 96-day-stale wrong-account content and is retired via operator action below.
  • docs/audit-2026-05-frontend.md catalogs 11 deferred frontend findings for v3.17.0+ scoping; each gets a GitHub issue with the audit-finding label post-merge.

Changes

  • internal/middleware/middleware.goSecurity() accepts *config.Config to read Security.CSPDisable. Hash + policy constants documented inline.
  • internal/config/config.goSecurityConfig.CSPDisable loaded via getEnvBool("CSP_DISABLE", false).
  • internal/middleware/middleware_test.goTestSecurity updated to assert new headers + X-XSS-Protection absent. TestSecurity_FOUCScriptHashMatches reads web.Assets and asserts the hardcoded hash matches base.html's inline script content. TestSecurity_ExactlyOneInlineJavaScript walks templates and asserts no new inline <script> slips in without a hash (JSON-LD excluded — non-JS MIME). TestSecurity_CSPDisableSkipsCSPHeader covers the toggle.
  • .env.example, docs/configuration.md document CSP_DISABLE and the full security-header set.
  • README.md, docs/audit-2026-05-frontend.md, CHANGELOG.md carry the demo-retire pointer + audit index + release notes.

Test plan

  • make lint (post golangci-lint cache clean) — 0 issues
  • make test-race — green
  • curl -sI http://localhost:3000/ — emits CSP/HSTS/Permissions-Policy/X-Content-Type-Options/X-Frame-Options/Referrer-Policy; X-XSS-Protection absent
  • CSP_DISABLE=true ./build/markgo serve — CSP absent, other 5 headers present
  • Browser DevTools console on /, /writing, /writing/<slug>, /about, /p, /search, /compose — no CSP violations
  • Service worker offline-queue: queue a compose draft, go offline, reload, return online — POST replays without CSP block

Operator actions (post-merge, manual)

  • gh api repos/1mb-dev/markgo/pages --method DELETE (or disable Pages in repo settings) — retires the stale demo
  • gh api repos/1mb-dev/markgo --method PATCH -f homepage=https://log.1mb.dev — keeps the sidebar link valid after Pages disable
  • File 11 audit-finding issues from docs/audit-2026-05-frontend.md and backfill the Issue column

vnykmshr added 3 commits May 18, 2026 19:36
Adds CSP (enforcing, with SHA-256 hash for the single inline FOUC script),
HSTS (max-age=31536000; includeSubDomains, no preload), Permissions-Policy
denying 9 unused features incl. interest-cohort. Drops X-XSS-Protection
(deprecated; Chrome removed support, Firefox never had it). CSP_DISABLE
env var skips the CSP header for operators whose edge proxy emits its own.

Regression tests lock the FOUC script hash against base.html and assert
exactly one inline JavaScript across templates (JSON-LD excluded).
…e notes

12 deferred items filed to docs/audit-2026-05-frontend.md as a tracked
index; each gets a GitHub issue (audit-finding label) post-merge.
CHANGELOG v3.16.0 entry consolidates security headers + Live install
README + audit-doc additions.
@vnykmshr
Copy link
Copy Markdown
Collaborator Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

@vnykmshr vnykmshr merged commit 473debf into main May 18, 2026
6 checks passed
@vnykmshr vnykmshr deleted the feat/v3.16.0 branch May 18, 2026 14:39
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.

1 participant