vercel / styled-jsx

Full CSS support for JSX without compromises
http://npmjs.com/styled-jsx
MIT License
7.7k stars 261 forks source link

Adding Content Security Policy with Next.js + styled-jsx #657

Open KarthikeyanRanasthala opened 4 years ago

KarthikeyanRanasthala commented 4 years ago

Do you want to request a feature or report a bug?

Yes, Improve documentation. Please add relevant details/steps on adding nonce for Content Security Policy with styled-jsx + next.js As next.js handles styled-jsx internally, the current mentioned method in the doc is not applicable. This is a major concern as all the next.js apps using styled-jsx have to add 'unsafe-inline' in the CSP. I would request the maintainers to take up this on priority.

xereda commented 6 months ago

Any news regarding this issue? @KarthikeyanRanasthala

KarthikeyanRanasthala commented 6 months ago

I contributed an example to Next.js repo many years ago. But its no longer available.

You can look into https://github.com/vercel/next.js/pull/23021 and https://github.com/vercel/next.js/tree/canary/examples/with-strict-csp to get an idea.

TBH, I haven't tried it out in app router, so lemme know how it goes.

xereda commented 6 months ago

I updated to version 14, but I still use Page Router. Where can I apply "registry.styles({ nonce })"? In my project I use Next.js + styled-jsx. And it is precisely in the styled-jsx styles that the "nonce" is not being applied in the DOM.