Skip to content

[frontend] - Add Content Security Policy and Security Headers Audit #120

Description

@dark-sarge

Location: frontend/next.config.js

Description

No Content Security Policy (CSP) or other security headers are set on the Next.js frontend. Without a CSP, XSS attacks can steal JWT tokens or hijack the Paystack payment flow. A strict CSP and full security header audit must be implemented via Next.js's headers() config.

Acceptance Criteria

  • next.config.js defines a headers() function that applies security headers to all routes: Content-Security-Policy, X-Frame-Options: DENY, X-Content-Type-Options: nosniff, Referrer-Policy: strict-origin-when-cross-origin, Permissions-Policy.
  • The CSP allows: default-src 'self', Paystack JS from https://js.paystack.co, Next.js inline scripts via a nonce, and no unsafe-eval.
  • The nonce-based CSP is implemented using Next.js middleware to generate a per-request nonce injected into the <script> tags and the CSP header simultaneously.
  • https://securityheaders.com scores the deployed frontend at grade A or higher.
  • HTTPS is enforced in production: the server sets Strict-Transport-Security: max-age=31536000; includeSubDomains.
  • The CSP is tested against the Paystack inline checkout to ensure payment functionality is not broken by the policy.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave program

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions