rc-util's getScrollBarSize Does Not Respect ConfigProvider's csp.nonce, Causing CSP Violations
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- react, typescript
Hướng nghiên cứu
Bắt đầu bằng cách đọc src/getScrollBarSize.tsx quanh dòng 49 và lần theo cách lời gọi updateCSS của nó được thực hiện khi rc-table sử dụng getScrollBarSize. Kiểm tra cách csp nonce của ConfigProvider được cung cấp cho tiện ích này. Hoàn thành khi style đo scrollbar được chèn vào sử dụng nonce đã cấu hình và không còn gây ra lỗi vi phạm CSP đã được báo cáo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
The getScrollBarSize function in rc-util dynamically injects CSS using updateCSS for measuring scrollbar size. However, it does not respect the nonce value provided via the ConfigProvider's csp property. This leads to CSP violations in environments with strict style-src policies.
Steps to Reproduce
- Set up a project using
antdwith aConfigProviderconfigured to include anoncevalue:<ConfigProvider csp={{ nonce: 'test-nonce', }} > - Use a component that indirectly triggers the
getScrollBarSizefunction (i.e.Tablefromrc-table) - Observe CSP violations in the browser console, such as:
Refused to apply inline style because it violates the following Content Security Policy directive: "style-src 'self' 'nonce-test-nonce'".
Expected Behavior
The getScrollBarSize function should respect the configured nonce by passing it to the updateCSS function when dynamically injecting styles.
Affected Code
The relevant part of the getScrollBarSize.tsx, line 49:
updateCSS(
`
#${randomId}::-webkit-scrollbar {
${widthStyle}
${heightStyle}
}`,
randomId,
);
Additional info
This issue was first introduced in the following commit: Commit Hash: e96b0c6
- Ngôn ngữ chính
- TypeScript
- Star
- 671
- Fork
- 214
- Merge trung bình
- 2 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 1
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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của react-component/util
-
isEqual: false 'circular references' warning for a reference repeated across sibling keysCó thể đã có người làm @savkaoleg đã nhận 79 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
react-component/util#816 ·
-
injectCSS method not attaching csp nonce passed to it. it is used in antd components internallyĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
react-component/util#671 · 1 bình luận ·
-
isEqual returns true for objects with different keys when a value is undefined, and for {} vs []Có thể đã có người làm @bardrop đã nhận 20 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 25/100
react-component/util#829 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
react-component/util#738 · 1 bình luận · 1 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
react-component/util#710 ·
Tất cả issue của react-component/util
Issue tương tự
-
dependencies effort: small good first issue priority: low
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
TMHSDigital/screencast-mcp#509 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
from-review tech-debt testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
blamechris/chroxy#9520 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:web complexity:S priority:P2 type:chore
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
nahuelcostac/agent-hub#104 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
snaglet-org/snaglet#78 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent/guide documentation help wanted stage/010-actionable
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
kubestellar/console-marketplace#1101 ·
Maintainer thường phản hồi trong vòng 1 ngày