Document the security headers#220
Merged
mikewheeleer merged 2 commits intoJun 29, 2026
Merged
Conversation
…-architecture docs(security): add security-headers reference and link from README
Contributor
Author
|
** @mikewheeleer please merge. |
Contributor
|
solid — merging this 🙌 |
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.
Motivation
The project ships a non-trivial set of HTTP hardening headers and a per-route CSP in src/lib/securityHeaders.ts (used from next.config.ts) that were not documented, leaving contributors unsure about unsafe-inline/unsafe-eval, how connect-src is derived from the API base, and how to safely add allowed origins.
Description
Add docs/security-headers.md documenting the full response header map, every CSP directive emitted by buildCsp(), the originOf()/connect-src behavior, the rationale for script-src 'unsafe-inline' and isDev-only 'unsafe-eval', and guidance for safely adding or relaxing origins and directives.
Cross-link the new reference from the README security section so the architecture is discoverable for contributors, and call out the relationship to the pre-paint theme script in src/app/layout.tsx and the source files that own the behavior (src/lib/securityHeaders.ts, next.config.ts).
Testing
Ran a source cross-check with rg to verify every documented header and directive appears in src/lib/securityHeaders.ts, next.config.ts, src/app/layout.tsx, docs/security-headers.md, and README.md, and the grep check succeeded.
Ran npm run lint, which failed due to unrelated pre-existing lint errors in src/components/Header.tsx and a test file, so lint did not pass in this environment.
Ran npm run build, which was blocked in this environment by Google Fonts fetch failures during next/font fetches (network/resource errors), so a full build could not be completed here.
Closes #158