Repository navigation
feat: add security.txt and security headers for the frontend - #680
Merged
Merged
Conversation
Serve /.well-known/security.txt (RFC 9116) from the backend and the frontend, pointing to the GitHub advisory form. The frontend hosts (Firebase and the nginx image) now send a Content-Security-Policy, X-Content-Type-Options, X-Frame-Options and Referrer-Policy. The backend's default CSP also restricts form-action. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SWRrkKuxAPsQcvYvcdPEZh
|
Visit the preview URL for this PR (updated for commit 397244e): https://tormap-36f44--pr680-claude-project-threa-se84h1mr.web.app (expires Fri, 06 Nov 2026 22:42:44 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 0c1f71965de18e60b0e686b0d0356977fec090dc |
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.
Requested by ju · project thread
Hardening based on the internet.nl website tests for tormap.org and api.tormap.org.
Changes
/.well-known/security.txton both hosts, pointing to the GitHub advisory form andSECURITY.md.Expiresis 180 days after the build (frontend) or the request (backend), so it never goes stale while the project is maintained.SecurityTxtController, explicitly permitted for GET inSecurityConfig, covered bySecurityRulesTest.firebase.jsonno longer ignores dot paths, so.well-known/gets deployed.security-headers.conf, included in every location):Content-Security-Policy,X-Content-Type-Options: nosniff,X-Frame-Options: DENY,Referrer-Policy: no-referrer. The CSP allows scripts only from the own origin, images from the own origin,data:, the CARTO tile host and GitHub avatars, and connections only to the own origin andapi.tormap.org. Styles need'unsafe-inline', because MUI/Emotion inserts<style>elements at runtime and static hosting can't add per-request nonces.form-action 'none'.server_tokens off,charset utf-8for.well-known, missing.well-knownfiles return 404 instead ofindex.html.THREAT_MODEL.mddocuments the frontend CSP and adds a checklist item for new external hosts.Testing
SecurityRulesTest,SecurityTxtControllerTestand the otherconfig/controllertests pass; frontend unit tests (120) and lint pass./,/assets/,/sw.jsand/.well-known/.style-src 'self'only, MUI renders unstyled, which is why'unsafe-inline'stays.Deployment notes
The
api.tormap.orgreverse proxy should pass through/.well-known/security.txtand the backend's security headers.Generated by Claude Code