-
Notifications
You must be signed in to change notification settings - Fork 426
feat(clerk-react): Add 'nonce' prop to ClerkProvider #3858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 07a0c76 The changes in this PR will be included in the next version bump. This PR includes changesets to release 15 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
brkalow
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a changeset!
| // extra layer. | ||
| if (/[&><\u2028\u2029]/g.test(nonce)) { | ||
| throw new Error( | ||
| 'Nonce value from Content-Security-Policy contained HTML escape characters.\nLearn more: https://nextjs.org/docs/messages/nonce-contained-invalid-characters', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's expand the error message and change the link here 👀
|
Added a changeset to let the tests run :) |
brkalow
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
Co-authored-by: Nikos Douvlis <[email protected]> Co-authored-by: Bryce Kalow <[email protected]>
Description
When using a strict-dynamic content security policy, Clerk currently will not work, as we do not pass a nonce to the hotloaded clerk-js script. This PR adds a
nonceprop toClerkProviderthat can be used to thread the nonce value through to the clerk-js script load. It also includes an extra feature for next.js where the nonce will be automatically pulled from the CSP header and threaded through without needing any props so long as the provider is server-rendered.Checklist
npm testruns as expected.npm run buildruns as expected.Type of change