security: add CSP + standard security headers in nginx (demo + prod) #37
Labels
No labels
app:activities
app:chat
app:events
app:forum
app:libra
app:market
app:restaurant
app:tasks
app:wallet
app:webapp
bug
enhancement
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
aiolabs/webapp#37
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
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?
Summary
nginx.conf.exampleand the per-host nginx vhosts (server-deployhosts/*/) don't set any security response headers today. A handful are zero-effort and high-leverage, especially given the prvkey-in-memory model: anything that limits attacker surface area before #11's centralised SigningService lands is worth doing.Risk: MEDIUM — defensive hardening, not closing a known active exploit.
Headers to add
Content-Security-Policy<script>from user content can't runX-Frame-OptionsDENYX-Content-Type-OptionsnosniffReferrer-Policystrict-origin-when-cross-origin?token=…!) to outbound linksPermissions-Policycamera=(), microphone=(), geolocation=()(lift per-app where needed)Strict-Transport-Securitymax-age=31536000; includeSubDomainsAcceptance criteria
nginx.conf.exampleships a documentedadd_headerblock (or a reusableincludesnippet) that sets the headers above.server-deploy/modules/services/webapp-standalone.nixand the main webapp module's nginx config) inherit those headers.'unsafe-inline', no'unsafe-eval'). Document any allowance with a comment explaining why.Notes / known constraints
script-src 'self'should hold.style-src 'self' 'unsafe-inline'only if necessary; document why.?token=…cross-subdomain auth relay in the chakra hub is a referrer-leak risk ifReferrer-Policyis permissive —strict-origin-when-cross-originkeeps the path/query out of the referrer header on cross-origin requests.Out of scope