Blocks 1.0: missing HSTS, CSP, and Permissions-Policy security headers #91
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
From the audit against the canonical
~/dev/prompts/prompts/REPO_POLICIES.md. Independently verified againstmainat61f42e6. (The repo's ownREPO_POLICIES.mdis byte-identical to canonical, sha256117dde7f148ed3cd693b333312f6345a0a0ee84fadbbe5cca559ca6fed4a1775, so this audit ran against the current standard.)REPO_POLICIES.mdrequires, explicitly gated on tagging 1.0:> Security headers on every response:
Strict-Transport-Security(HSTS) withmax-ageof at least one year andincludeSubDomains.Content-Security-Policy(CSP) with a restrictive default policy (default-src 'self'as a baseline)...Permissions-Policyrestricting access to browser features the application does not useSecurityHeaders()(internal/middleware/middleware.go:148-166) sets exactly four headers:X-Content-Type-Options,X-Frame-Options,Referrer-Policy,X-XSS-Protection. A repo-wide grep forStrict-Transport|Content-Security-Policy|Permissions-Policyacrossinternal/andcmd/returns zero matches — verified.CSP is not academic here: the repo serves HTML (
internal/templates/login.html,internal/templates/generator.html) and loads a script asset (internal/static/tailwind.js). The policy also prefersframe-ancestorsas the primary clickjacking control, withX-Frame-Optionsas the legacy fallback; only the fallback exists today.Definition of done
SecurityHeaders()additionally sets:Strict-Transport-Security: max-age=31536000; includeSubDomainsContent-Security-Policywithdefault-src 'self'andframe-ancestors 'none', tightened around the Tailwind asset. Ifunsafe-inlineproves unavoidable, the policy requires documenting the reason — do that in a code comment and the PR body, and prefer moving inline styles/scripts to the served asset instead.Permissions-Policydenying browser features pixa does not use (camera, microphone, geolocation, etc.)internal/middlewareasserting each header is present on a representative response (that package currently has only two tests — see the middleware coverage issue).make checkgreen.Priority
Blocks 1.0.0 per the policy's own wording. Note
internal/middleware/middleware.gois not touched by either open PR, so this can proceed independently once the queue clears.