davidhu2000 / react-spinners

A collection of loading spinner components for react
https://www.davidhu.io/react-spinners
MIT License
3.01k stars 262 forks source link

Support CSP nonce #606

Open sdemjanenko opened 1 week ago

sdemjanenko commented 1 week ago

I am running in to an issue with the inline styles that this library is injecting: https://github.com/davidhu2000/react-spinners/blob/6f6d0f8b5d5f7ee2ea217682c227f2af77de73b1/src/helpers/animation.ts#L9. This could be fixed by exposing a Provider which can then receive a nonce to use for the inline style injection. See emotion's solution for this: https://emotion.sh/docs/@emotion/cache#nonce.

Im not sure if animations are the only place in the codebase that inject inline styles. All places would need to be updated to use a provided nonce.