security: add baseline security headers on Netlify - #639
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mesutoezdil The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
✅ Deploy Preview for project-hami ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Warning Review limit reached
Next review available in: 59 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds baseline security headers to the Netlify deployment by introducing a global (for = "/*") headers rule in netlify.toml, intended to improve browser-side security defaults for the static Docusaurus site while preserving existing per-path header rules.
Changes:
- Adds a wildcard Netlify
[[headers]]block applying baseline security headers across all routes. - Keeps existing per-path header blocks (e.g.,
/.well-known/*,/robots.txt,/) intact to rely on Netlify’s header rule behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Adds nosniff, clickjacking protection, referrer policy, a minimal permissions policy and HSTS for all site paths. Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
576389e to
243dcbb
Compare
What
Adds a
for = "/*"headers block tonetlify.tomlwith baseline security headers:X-Content-Type-Options: nosniffblocks MIME sniffingX-Frame-Options: SAMEORIGINblocks clickjacking via third-party framingReferrer-Policy: strict-origin-when-cross-originavoids leaking full URLs to external sitesPermissions-Policydisables camera, microphone and geolocation, which the site never usesStrict-Transport-Security(1 year) keeps browsers on https after the first visit;includeSubDomainsis deliberately omitted so a future or legacy non-HTTPS subdomain cannot be hard-failed by a policy served from the apexExisting per-path header blocks are untouched; Netlify merges them with the wildcard block.
Why
The site currently serves no security headers at all. These five are the standard no-risk baseline for a static documentation site; none of them can break Docusaurus functionality. A CSP is deliberately left out because Docusaurus relies on inline scripts and would need careful nonce handling.
Testing
netlify.tomlparses as valid TOML (10 header blocks)