injectCSS method not attaching csp nonce passed to it. it is used in antd components internally
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 65/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- javascript, typescript
- Domain
- frontend
Research direction
Start by reading node_modules/rc-util/es/Dom/dynamicCSS.js and node_modules/rc-util/lib/Dom/dynamicCSS.js, focusing on injectCSS and its CSP handling. Confirm the implementation preserves the nonce passed to injectCSS on the generated style element, then add or update a relevant test if the repository provides one.
Written by the indexing model from the issue text.
Description
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch rc-util@5.44.4 for the project I'm working on.
Here is the diff that solved my problem:
diff --git a/node_modules/rc-util/es/Dom/dynamicCSS.js b/node_modules/rc-util/es/Dom/dynamicCSS.js
index 8ddec00..9e5efee 100644
--- a/node_modules/rc-util/es/Dom/dynamicCSS.js
+++ b/node_modules/rc-util/es/Dom/dynamicCSS.js
@@ -52,7 +52,8 @@ export function injectCSS(css) {
styleNode.setAttribute(APPEND_PRIORITY, "".concat(priority));
}
if (csp !== null && csp !== void 0 && csp.nonce) {
- styleNode.nonce = csp === null || csp === void 0 ? void 0 : csp.nonce;
+ styleNode.setAttribute('nonce', csp.nonce);
+ // styleNode.nonce = csp === null || csp === void 0 ? void 0 : csp.nonce;
}
styleNode.innerHTML = css;
var container = getContainer(option);
diff --git a/node_modules/rc-util/lib/Dom/dynamicCSS.js b/node_modules/rc-util/lib/Dom/dynamicCSS.js
index 95a5191..be33605 100644
--- a/node_modules/rc-util/lib/Dom/dynamicCSS.js
+++ b/node_modules/rc-util/lib/Dom/dynamicCSS.js
@@ -62,7 +62,8 @@ function injectCSS(css) {
styleNode.setAttribute(APPEND_PRIORITY, "".concat(priority));
}
if (csp !== null && csp !== void 0 && csp.nonce) {
- styleNode.nonce = csp === null || csp === void 0 ? void 0 : csp.nonce;
+ styleNode.setAttribute('nonce', csp.nonce);
+ // styleNode.nonce = csp === null || csp === void 0 ? void 0 : csp.nonce;
}
styleNode.innerHTML = css;
var container = getContainer(option);
This issue body was partially generated by patch-package.
- Dominant language
- TypeScript
- Stars
- 670
- Forks
- 205
- Avg merge
- 15d 17h
- Merged PRs (30d)
- 6
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from react-component/util
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
react-component/util#816 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
react-component/util#738 · 1 comment · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
react-component/util#710 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
react-component/util#647 · 5 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
react-component/util#644 · 1 comment ·
All issues in react-component/util
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100