Security audit fixes: JWT secret guard, WS revocation, nginx headers/TLS, loopback Gitea
Deploy with Docker Compose / deploy (push) Successful in 59s
Deploy with Docker Compose / deploy (push) Successful in 59s
- auth: panic at init if BACKEND_SECRET missing/short — HS256 would happily start with an empty key, making admin tokens forgeable by anyone - websocket: admin check now goes through AuthenticateTokenWithClaims so the "tv" token-version revocation applies on /ws too; a logged-out or password-changed token no longer keeps it alive for its full lifetime - admin diagnostics: check BACKEND_SECRET not the nonexistent AUTH_SECRET - rowing upload: 10MB cap before buffering + base64 (admin-only route, but unbounded read = easy memory exhaustion + huge paid Claude call) - nginx: shared security_headers.conf (XFO/nosniff/Referrer-Policy/HSTS/CSP) included in every location that sets its own add_header — nginx drops the parent's whole set otherwise; CSP added to the SPA document; ssl_protocols pinned to TLSv1.2/1.3; HSTS on apex redirect - compose: Gitea HTTP bound to 127.0.0.1 (plain HTTP was LAN-exposed); autoheal docker socket mount read-only Co-Authored-By: Claude Code <[email protected]>
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
# Included at every level that sets at least one of its own add_headers.
|
||||
# nginx replaces a parent's whole add_header set inside any block that
|
||||
# declares one of its own, so without this include, locations like /assets/
|
||||
# and /sound/ silently lose every security header the server block sets.
|
||||
# Locations that add extra headers of their own (the /uploads/ blocks) can
|
||||
# include this AND their own lines; the include plus their own add_header
|
||||
# directives merge additively.
|
||||
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||||
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;
|
||||
|
||||
# Applied to the main document; the /uploads/ blocks override with their own
|
||||
# locked-down CSP by declaring Content-Security-Policy again themselves
|
||||
# (a later add_header of the same name within one response wins).
|
||||
add_header Content-Security-Policy "default-src 'self'; img-src 'self' data: https:; style-src 'self' 'unsafe-inline'; font-src 'self' data:; connect-src 'self'; frame-ancestors 'self'; base-uri 'self'; object-src 'none'" always;
|
||||
Reference in New Issue
Block a user