-
Notifications
You must be signed in to change notification settings - Fork 178
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
csp nonce configuration doesn't seem to work #392
Comments
Is this getting worked on? currently facing this exact issue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Noticed that when using the <ConfigProvider csp={{ nonce: "test" }} > configuration capabilities from Ant Design this isn't being applied properly by rc-util.
While debugging I noticed that the configuration does reach the code (https://github.com/react-component/util/blob/master/src/Dom/dynamicCSS.ts#L64) but somehow doesn't add it when for example a stylesheet is injected for the datepicker component of Ant Design.
Seemingly changing the line in https://github.com/react-component/util/blob/master/src/Dom/dynamicCSS.ts#L64
from:
styleNode.nonce = csp?.nonce;
to
styleNode.setAttribute("nonce", csp.nonce);
does fix this.
Does anyone have any other idea as to why this doesn't work in the browser but seems to work within the testcases of this library?
A reproduction can be found here: https://codesandbox.io/s/antd-reproduction-template-forked-su9wdz
When you check the console you can see the stylesheet is injected without setting a nonce:
The text was updated successfully, but these errors were encountered: