Skip to content

security(headers): add CSP and defense-in-depth security headers (closes #146) - #1078

Open
jdjioe5-cpu wants to merge 1 commit into
FlowwStar:mainfrom
jdjioe5-cpu:fix/issue-146-security-headers-csp
Open

jdjioe5-cpu wants to merge 1 commit into
FlowwStar:mainfrom
jdjioe5-cpu:fix/issue-146-security-headers-csp

Conversation

@jdjioe5-cpu

Copy link
Copy Markdown
Contributor

Summary

This PR resolves #146 by configuring defense-in-depth security headers and Content Security Policy (CSP) in next.config.mjs.

Changes

  • Configured HTTP security headers in nextConfig.headers() applied to /:path*:
    • Content-Security-Policy:
      • Restricts default loading to 'self'
      • Supports inline Tailwind and shadcn/ui styling via style-src 'self' 'unsafe-inline'
      • Enables connections to Stellar Horizon and Soroban RPCs (https://*.stellar.org), public testnet/mainnet endpoints, and stellar.expert price feeds
      • Sets object-src 'none', frame-ancestors 'none', and base-uri 'self'
    • X-Content-Type-Options: nosniff: Prevents MIME sniffing
    • X-Frame-Options: DENY: Prevents clickjacking
    • Referrer-Policy: strict-origin-when-cross-origin: Restricts referrer leakage
    • Permissions-Policy: camera=(), microphone=(), geolocation=(): Disables unused browser hardware APIs
  • Added automated unit test suite in __tests__/next-config.test.ts to verify the headers configuration and CSP directive coverage.

Testing

  • npx vitest run next-config --coverage.enabled=false
    • 3 passed (100% test pass rate)

Closes #146.

This branch had an error being deployed

1 failed deployment
staging — 7232db31 Deployed Oct 24, 2026 by jdjioe5-cpu via deploy-staging #366
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

security: Add Content Security Policy and security headers

1 participant