Skip to content

fix: warn when CSP nonce is missing despite useNonce config#3863

Open
SisyphusZheng wants to merge 1 commit into
freshframework:mainfrom
SisyphusZheng:fix/csp-nonce-warn
Open

fix: warn when CSP nonce is missing despite useNonce config#3863
SisyphusZheng wants to merge 1 commit into
freshframework:mainfrom
SisyphusZheng:fix/csp-nonce-warn

Conversation

@SisyphusZheng

@SisyphusZheng SisyphusZheng commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

When useNonce: true is configured in the CSP middleware but the response handler uses ctx.html() / ctx.json() instead of ctx.render(), the nonce is absent and the CSP silently falls back to unsafe-inline with zero indication to the developer.

Add a console.warn when this happens so developers are aware their CSP is weaker than expected.

Closes #3859

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.

CSP nonce silently degrades to unsafe-inline without warning

1 participant