Skip to content

fix(header): Restrict csp headers#1577

Open
rudra-superrr wants to merge 3 commits intoeclipse-sw360:mainfrom
siemens:fix/CSP_header2
Open

fix(header): Restrict csp headers#1577
rudra-superrr wants to merge 3 commits intoeclipse-sw360:mainfrom
siemens:fix/CSP_header2

Conversation

@rudra-superrr
Copy link
Copy Markdown
Contributor

@rudra-superrr rudra-superrr commented Apr 3, 2026

Summary
Harden the Content-Security-Policy header in next.config.ts as recommended by CRA security assessment.

Problem
The CSP header was using insecure keywords unsafe-eval in the script-src directive unconditionally, and was missing restrictive directives like object-src.

Note: 'unsafe-inline' is retained in script-src as inline scripts are currently used in the codebase. The proper fix is to implement a nonce-based CSP- generating a per-request nonce in the middleware, propagating it via the root layout, and refactoring the inline script usages to use safe rendering patterns.

Testing
Start the server
Check headers via curl
curl -sI http://localhost:3000/ | grep -i "content-security-policy"

@deo002 deo002 self-assigned this Apr 6, 2026
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.

3 participants