feat(security): implement Content Security Policy - #82
Merged
Conversation
- Add kit.csp to svelte.config.js with mode: 'hash': default-src/connect-src/img-src 'self'; script-src with hashes; style-src 'self'; font-src/object-src 'none'; base-uri/form-action 'self'; frame-ancestors 'none'; upgrade-insecure-requests - CSP delivered as HTTP header (Cloudflare Worker SSR) so frame-ancestors is enforced; X-Frame-Options remains as legacy fallback - Replace style="display: contents" in app.html with Tailwind contents class to eliminate the one inline style attribute - Manually hash the theme-detection inline script in app.html; SvelteKit auto-hashes its bootstrap script per render - Document method restriction (405 on non-GET), CSP reporting gap, and coordinated disclosure policy in SECURITY.md - Restructure SECURITY.md: new Runtime protections section between How the application works and Supply chain controls
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
kit.csp—mode: 'hash', delivered as an HTTP response header (not meta tag, soframe-ancestorsis enforced by the Cloudflare Worker SSR path)default-src 'self';script-src 'self' <hashes>(nounsafe-inline);style-src 'self';connect/img-src 'self';font/object-src 'none';base-uri/form-action 'self';frame-ancestors 'none';upgrade-insecure-requestsapp.htmlmanually hashed; SvelteKit auto-hashes its bootstrap script per renderstyle="display: contents"→class="contents"(Tailwind utility) to eliminate the one inline style attribute that would have requiredunsafe-hashesTest plan
content-security-policy, confirm SAML/JWT decode works, confirm no console CSP violations