react-wrap-balancer icon indicating copy to clipboard operation
react-wrap-balancer copied to clipboard

Support for strict CSP on static pages

Open prichey opened this issue 2 years ago • 0 comments
trafficstars

First of all, thanks for the library - I have enjoyed using it on a variety of pages and find it works very well for my purposes.

I have ran into an issue in using it on static pages, though, due to a strict CSP which prevents unsafe-eval. I am aware of the nonce prop which was introduced in https://github.com/shuding/react-wrap-balancer/pull/61 - this works well for SSR pages, but as I understand it does not work for static pages, because a nonce should differ per request.

What is the recommended solution in this situation? I understand a hash is difficult to implement since the injected scripts will vary in number and content. Would it be possible to introduce a prop that disables injecting the script on static pages, such that the balancer only runs at build time?

I'm happy to help collaborate on a solution for this if there's agreement about the correct solution. Thanks!

prichey avatar Jul 24 '23 14:07 prichey