rc-util's getScrollBarSize Does Not Respect ConfigProvider's csp.nonce, Causing CSP Violations
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- react, typescript
調査の方向性
まず src/getScrollBarSize.tsx の49行目付近を読み、rc-table が getScrollBarSize を使用したときにその updateCSS 呼び出しに到達するまでの流れを追ってください。ConfigProvider の csp nonce がこのユーティリティから利用可能になる仕組みを確認してください。注入されるスクロールバー測定用のスタイルが設定された nonce を使用し、報告されている CSP 違反を引き起こさなくなれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- TypeScript
- スター
- 670
- フォーク
- 205
- 平均マージ
- 15日 17時間
- マージ済み PR(30日)
- 6
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
react-component/util のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
react-component/util#816 ·
-
injectCSS method not attaching csp nonce passed to it. it is used in antd components internally オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
react-component/util#671 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
react-component/util#738 · コメント 1 件 · リアクション 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
react-component/util#710 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
react-component/util#647 · コメント 5 件 ·
react-component/util の issue をすべて見る
似ている issue
-
S: triage
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
fix(errors): EHOSTUNREACH from a happy-eyeballs connect is reported as a resolver error (STAMP-80) オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
snapshot-labs/stamp#666 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
GauravKarakoti/SecureFlow#1070 · コメント 1 件 ·
-
feature:Languages/Translations good first issue ready Web
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
digitalfabrik/integreat-app#4394 ·