-
Notifications
You must be signed in to change notification settings - Fork 22
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
Mitigations for being unable to use a nonce #5
Comments
style-src
This package is terrific, thanks for putting it together. But additionally yeah I'd like to see handling for inline Scripts (such as pushing |
TL;DRThere's not a good option for implementing strong CSP on a Next.js application until we can solve #23993. Yeah, I should probably add something about this to the README. Unfortunately, nothing has changed since this past June. We still don't have access to a nonce or hashes when rendering headers, which means we can't handle inline scripts in any significant way. However, I'm trying to connect with the Next team to solve that problem. In the meantime, your options for strong CSP in a Next application are:
|
Hi, I played around with I wrote a more detailed comment here: vercel/next.js#31402 (comment) Code of my experiments: https://gist.github.com/nibtime/844b0286f3c73f30488118625d11a5d1 |
This is really interesting, @nibtime. We actually have #12 already for creating an edge middleware, we just haven't gotten around to doing it yet. I'm going to do a deeper dive into your code today to see what would be necessary to implement it directly into If you're game to pair on that work at some point, I'd love to do so. Feel free to join my Discord and hit me up. |
Hi @trezy
Sure, I'd love that. I also just started with the CSP topic, the code at this point is mainly a verification for my understanding around CSP and Next and as a PoC if 'strict-dynamic' was possible with static pages at all in a feasible way. I will join your Discord some time. I created a fresh issue (#36) with details towards implementing this. I think this could really benefit from being properly packaged up, documented and e2e tested within |
Hi there,
I had a read of this and it seems like I am unable to use a nonce for my style-src (Im using CSS in JS (styled-components)). I believe this is also the case for
'script-src'
- im seeing the same error.I was therefore wondering, what would be the "next best" values for these? If I have to use
'unsafe-eval'
or'unsafe-inline'
for these to get around this, is there any point in me using this package?Apologies for asking this here, its not really an issue.
Thanks
The text was updated successfully, but these errors were encountered: