Skip to content

security: enforce strict CSP in production middleware #445

Description

@nanaf6203-bit

Summary

src/middleware.ts references CSP_ENFORCE env flag but there is no observable test for the strict CSP.

Affected area

src/middleware.ts, src/app/api/csp-report/route.ts

Steps to reproduce / impact

Without a strict CSP, XSS payloads (covered by #13, #22, #23) become viable. CSP is the second line of defence.

Expected behaviour

Publish a baseline CSP (default-src 'self'; img-src 'self' data: ipfs:; script-src 'self' 'nonce-…'), enforce in production, and report-only in non-prod.

Acceptance criteria

  • Document CSP.
  • Add a Playwright test verifying CSP blocks inline scripts.
  • Add CSP report-only in dev and confirm reports land.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programpriority/p1P1 — high priority, fix soonsecuritySecurity issue or hardening opportunity

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions