TASK-013: Add nginx security headers (CSP, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy)
- Added OWASP-recommended security headers to nginx server block - CSP allows same-origin scripts and inline styles (required for Fluent UI v9) - X-Frame-Options: DENY prevents clickjacking - X-Content-Type-Options: nosniff prevents MIME-sniffing - Referrer-Policy: no-referrer prevents URL leakage - Permissions-Policy: disables geolocation, microphone, camera APIs - HSTS commented out until HTTPS is fully configured - All headers use 'always' directive for error responses (4xx, 5xx) - Updated Architekture.md with security header documentation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -829,6 +829,27 @@ Request → /api/typos
|
||||
|
||||
---
|
||||
|
||||
## 9.2a nginx Security Headers
|
||||
|
||||
nginx adds the following OWASP-recommended security headers to all responses:
|
||||
|
||||
| Header | Value | Purpose |
|
||||
|---|---|---|
|
||||
| **Content-Security-Policy** | `default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self'; frame-ancestors 'none';` | Prevents XSS attacks by restricting script execution to same-origin. `style-src 'unsafe-inline'` is required for Fluent UI v9's inline styles. |
|
||||
| **X-Frame-Options** | `DENY` | Prevents clickjacking by disallowing iframe embedding. |
|
||||
| **X-Content-Type-Options** | `nosniff` | Prevents MIME-sniffing; browsers must respect the declared Content-Type. |
|
||||
| **Referrer-Policy** | `no-referrer` | Prevents leaking internal URLs in the `Referer` header to third-party resources. |
|
||||
| **Permissions-Policy** | `geolocation=(), microphone=(), camera=()` | Disables access to browser APIs not needed by the application. |
|
||||
| **Strict-Transport-Security** | *Commented out* | Must only be enabled after HTTPS is fully configured. Uncomment when TLS termination is production-ready. |
|
||||
|
||||
All headers use the `always` directive, ensuring they are included in error responses (4xx, 5xx) as well.
|
||||
|
||||
### CSP and Fluent UI
|
||||
|
||||
Fluent UI v9 applies styles via inline `style` attributes on DOM elements. To support this, `style-src 'unsafe-inline'` is required. A stricter CSP using nonces would require server-side rendering of the HTML shell, which is outside the current architecture.
|
||||
|
||||
---
|
||||
|
||||
## 9.3 Deployment Constraints
|
||||
|
||||
### Single-Worker Requirement
|
||||
|
||||
Reference in New Issue
Block a user