Skip to content
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

Add nonce to Partytown script for Content Security Policy #299

Closed
nicolaturcato opened this issue Nov 14, 2022 · 4 comments · Fixed by #416
Closed

Add nonce to Partytown script for Content Security Policy #299

nicolaturcato opened this issue Nov 14, 2022 · 4 comments · Fixed by #416

Comments

@nicolaturcato
Copy link

Is your feature request related to a problem? Please describe.
I have a problem while trying to use Partytown React component. I have a Content Security Policy set that prevents injecting inline scripts unless they have a nonce. Issue that appears is: "Refused to execute inline script because it violates the following content security policy directive".
In order to solve this problem I had to load the script from @builder.io/partytown/integration and passing the nonce to the script.

Describe the solution you'd like
Add "nonce" property to Partytown React component that needs then to be passed to Partytown script.

@sigginjals
Copy link

Hey @nicolaturcato, How did you manage to propagate the nonce to the scripts executed by Partytown?

@nicolaturcato
Copy link
Author

Hi @sigginjals ,
my issue was even before loading the scripts with Partytown.
My problem is directly on the Partytown script which is blocked by my CSP because it doesn't contain the nonce value.

@sigginjals
Copy link

sigginjals commented Feb 2, 2023

@nicolaturcato Once you fixed that, did the scripts get execute as expected?

@nicolaturcato
Copy link
Author

@sigginjals yes the nonce is passed at that point.

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 a pull request may close this issue.

2 participants