Frontend image serves zero security headers; add the full REPO_POLICIES set to nginx.conf #18
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?
Problem
nginx.conf(28 lines, serving the built SPA in theDockerfileruntime image) sets no security headers at all. Verified onmainatfbfe1df: the onlyadd_headerin the file isCache-Controlinsidelocation /assets/.REPO_POLICIES.mdrequires all of the following on every response, and explicitly gates 1.0 on it: "HTTP/web services must be hardened for production internet exposure before tagging 1.0."Missing, all of them:
Strict-Transport-Securitymax-age>= 1 year,includeSubDomainsContent-Security-Policydefault-src 'self'baselineX-Frame-OptionsDENY(withframe-ancestorsas the primary control)X-Content-Type-OptionsnosniffReferrer-Policystrict-origin-when-cross-originor stricterPermissions-PolicyThe CSP complication — read this before writing the policy
NetWatch is a latency monitor. Its whole function is issuing
fetch()requests to 22 third-party WAN hosts plus RFC1918 local addresses. A naivedefault-src 'self'CSP will break the application, becauseconnect-srcinherits fromdefault-srcand every probe will be blocked.The policy must therefore be written deliberately, not copy-pasted:
default-src 'self'as the baseline is correct and should stay.connect-srcmust be widened enough for the probes to work. Decide and justify: either enumerate the monitored origins, or acceptconnect-src *with a comment explaining that the app's purpose is arbitrary-origin reachability probing. Enumerating is the stronger option but couplesnginx.confto the host list insrc/main.js; if you enumerate, say in the PR how the two are kept in sync.<style>or inline script in the builtdist/index.html. If they do,style-srcneeds a hash or nonce — not'unsafe-inline'. Policy: "Never useunsafe-inlineorunsafe-evalunless unavoidable, and document the reason." If it truly is unavoidable, the reason goes in a comment innginx.confand in the PR description.img-srcneedsdata:if the app uses data-URI images; verify against the build output rather than guessing.Definition of done
nginx.conf, including error responses and the/assets/location. Note thatadd_headerin nginx does not inherit into alocationblock that has its ownadd_headerdirectives — verify/assets/actually emits the security headers too, do not assume.dist/output, not guessed. State in the PR description how it was verified.'unsafe-eval'. No'unsafe-inline'unless documented as unavoidable with a written justification.X-Frame-Options: DENYand aframe-ancestors 'none'CSP directive.max-ageis at least31536000and includesincludeSubDomains.Permissions-Policydenies at minimum camera, microphone, geolocation, and payment.docker build .succeeds;make checkpasses.TODO.mdupdated in the same commit.(closes #N).Implementation requirements
set_real_ip_from/real_ip_headerreverse-proxy configuration and the stdout access logging as they are; they are already correct.