fix(nginx): add HSTS to the security-headers block generator - #192
Merged
Conversation
Every nginx-fronted subdomain (api.nself.org, ping.nself.org, any custom
service) was missing Strict-Transport-Security. The weekly SSL Audit
correctly flagged api.nself.org for it — testssl confirmed grade A+ and
clean TLS, but no HSTS header at all, unlike the Vercel-hosted marketing
sites which already set it via vercel.json.
Per the Security-Always-Free doctrine, hardening ships free and automatic
via the CLI's generated nginx config, not as an opt-in env var or a hand
edit to the gitignored generated output (which nself build would wipe on
the next run anyway). Adds
`Strict-Transport-Security: max-age=63072000; includeSubDomains` to the
shared securityHeaders const so it lands in every server{} block the
generator emits.
Rolling this out to the live 5.75.235.42 box requires a CLI release +
prod CLI upgrade (currently 3 minor versions behind at v0.9.9) and is
tracked separately — that upgrade surfaced its own config-validation and
secret-regeneration behavior differences that need their own migration
plan, not a same-day side effect of an SSL audit fix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Strict-Transport-Security: max-age=63072000; includeSubDomainsto the sharedsecurityHeadersnginx directive block ininternal/nginx/generator.go, so every generated server block (api., ping., custom services) gets HSTS for free — per the Security-Always-Free doctrine.api.nself.orgfor missing HSTS (grade A+, clean TLS otherwise) — confirmed genuine via livecurl -sI, unlike the Vercel-fronted marketing domains which already set HSTS viavercel.json.Test plan
go build ./...succeedsgo test ./internal/nginx/...passes (includes updatedTestSecurityHeadersConstant)