Repository navigation
fix(security): send HSTS preload on every response path - #1313
Conversation
Lambda mode's static responses sent "max-age=31536000; includeSubDomains" while HTTP mode sent the same value plus "; preload". API responses and the health endpoint also lacked it. Move the value into one exported constant, api.HSTSHeaderValue, used by all four paths, and add a test that pins the Lambda, HTTP-mode and health headers to it. "preload" only makes the domain eligible for the browser preload list; submission to hstspreload.org remains a separate manual step. Closes LeanerCloud#14 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 6 billable files and costs up to $1.50. Or wait 59 minutes for your next included review. View limit details
Comment |
|
Autofix could not be updated. Open Coding to check access and billing. |
Brings in main's CI fixes (LeanerCloud#1236, LeanerCloud#1252) and CI changes since, so this PR gets a fresh CI run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent review (IAmJSD's agent, fresh context, given only the diff, the issue and the PR text): VERDICT: APPROVE Blocking:
Non-blocking:
Attacked:
Body-stale:
Reviewer: rB7. Bar while the maintainers are away (set by IAmJSD as acting owner): one approving independent review on the head, two for money, auth and security paths. |
|
Local verification at |
|
Merged by IAmJSD's agent at IAmJSD's request (IAmJSD is acting owner while the maintainers are away), under the bar IAmJSD set: 1 approving independent review(s) on |
What
Lambda mode's HSTS header dropped
preload, while HTTP mode sends it (#14). API responses (internal/api/handler.go) and the container health endpoint (internal/server/health.go) lacked it as well.The value now lives in one exported constant,
api.HSTSHeaderValue(max-age=31536000; includeSubDomains; preload). All four response paths use it:That way the modes can't drift apart again.
preloadonly makes the domain eligible for the browser preload list. Nothing is submitted. Submitting to hstspreload.org stays a separate manual step, and so does the decision to do it.Closes #14
Testing
On a14dc8f (main):
go build ./...passes.go vetpasses with and without-tags integrationoninternal/serverandinternal/api.go test -race -count=1 ./internal/server/ ./internal/api/passes.TestSecurityHeaders_HSTSMatchesAcrossModespins the Lambda, HTTP-mode and health headers to the constant and asserts it containspreload.handler_security_test.gonow expectpreload.gocyclo -over 10is clean on the changed files.scripts/test-git-secrets-allowlist.shgives 137 PASS. A git-secrets scan of the changed files in an isolated repo is clean, and the planted key was flagged.🤖 Generated with Claude Code