Skip to content

fix: add CSP nonce to component chunk scripts#93904

Open
IxayWolf wants to merge 1 commit into
vercel:canaryfrom
IxayWolf:fix/csp-nonce-component-scripts
Open

fix: add CSP nonce to component chunk scripts#93904
IxayWolf wants to merge 1 commit into
vercel:canaryfrom
IxayWolf:fix/csp-nonce-component-scripts

Conversation

@IxayWolf
Copy link
Copy Markdown

What?

Adds the parsed CSP nonce to App Router component convention chunk scripts emitted by createComponentStylesAndScripts.

Why?

Next already applies ctx.nonce to similar _next script tags in get-layer-assets, and next/dynamic preload nonce propagation was fixed in #81999. This path still emitted /_next/static/chunks/... scripts without a nonce, which can trigger script-src-elem violations under nonce-based CSP policies.

How?

Passes nonce: ctx.nonce when creating component convention script tags, and extends the CSP nonce e2e fixture with a client template route that exercises this renderer and asserts chunk scripts include the nonce.

Fixes #93903

LLM disclosure: Codex helped prepare this PR; I reviewed the change.

Local checks: git diff --check. I could not run the e2e suite in this fresh checkout because dependencies are not installed locally.

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.

App Router component chunk scripts are missing CSP nonce

1 participant