I came to a project that uses styled-components in the frontend written in React.
It seems the decision to use it was quite unfortunate as this component ignores security aspects and generates inlined styles.
Currently, in order to have the app running, there must be weakened security by specifying style-src 'unsafe-inline'
in Content Security Policy, which is not acceptable in enterprise applications (at least in our corporate).
It seems there is no workaround with this library except using nonce when server side rendering but we have currently static web and would prefer not to add SSR so this does not seem to be the right direction for us.
There is quite lot of code and rewriting the app completely would require weeks maybe even a few month.
Any experience with gradual moving away from styled-components? Is there some less painful way to get the security back?
question from:
https://stackoverflow.com/questions/66067089/what-is-a-good-replacement-for-styled-components-in-react-application-to-produ 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…