-
Notifications
You must be signed in to change notification settings - Fork 49
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
Using an inline script makes CSP unsafe #350
Comments
Hello @flowtsohg ! I was not aware of this, thanks for opening the issue.
Is it required to use script-src 'unsafe-inline'? From the link you provided:
Would it be possible to use any of those instead of 'unsafe-inline'? Maybe we could expose a I'm not against your approach and I think it should be a fairly easy change in the GoogleAnalytics component. If you have the time feel free to open a PR, I'll be glad to merge it. |
I went back to using your library because my code actually didn't work correctly, haha (albeit that's because I don't know gtag and am focusing on other things). |
Hi @flowtsohg ! The Is it ok to close this issue? |
Thanks! seems good to close |
Due to the inline script used to initialize
window.dataLayer
, CSP requiresscript-src 'unsafe-inline'
which makes the page less safe (for example).Since this is meant for Next/React, there is no reason to actually use the inline script - for now I stopped using this library for this reason and changed to the following code which uses a React effect instead of an inline script.
It would be nice if the library could do something similar to avoid the safety issue.
The text was updated successfully, but these errors were encountered: