Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

injectCSS method not attaching csp nonce passed to it. it is used in antd components internally

Đang mở Phù hợp với người mới
#671 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
65/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
javascript, typescript
Lĩnh vực
frontend

Hướng nghiên cứu

Bắt đầu bằng cách đọc node_modules/rc-util/es/Dom/dynamicCSS.js và node_modules/rc-util/lib/Dom/dynamicCSS.js, tập trung vào injectCSS và cách xử lý CSP của nó. Xác nhận rằng implementation giữ lại nonce được truyền vào injectCSS trên phần tử style được tạo ra, sau đó thêm hoặc cập nhật một test phù hợp nếu repository có cung cấp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] 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.

Ngôn ngữ chính
TypeScript
Star
670
Fork
206
Merge trung bình
14 ngày 12 giờ
Pull request đã merge (30 ngày)
3

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của react-component/util

Tất cả issue của react-component/util

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.