Strict CSP breaks bold tags in annotation text
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 18.3k
- フォーク
- 2k
- 平均マージ
- 2日 12時間
- マージ済み PR(30日)
- 28
説明
Using the new strict CSP support breaks bold tags in annotation text.
Steps to reproduce:
- Include the plotly.css file.
- Content Security Policy that disallows inline stylesheets.
- Annotations where the text includes
<b>tag.
I've reproduced this problem in Vue 3 with Plotly 3.0.1 here: https://stackblitz.com/edit/vitejs-vite-1gco7d7q?file=src%2Fcomponents%2FPlotlyExample.vue
The Plotly code is like so, with bold tags around the text annotations X axis and Y axis
Plotly.newPlot(plotlyContainer.value, [{ x: [1, 2, 3], y: [2, 1, 2] }], {
annotations: [
{
xref: 'paper',
yref: 'paper',
x: 0,
xanchor: 'right',
y: 1,
yanchor: 'bottom',
text: '<b>X axis</b> label',
showarrow: false,
},
{
xref: 'paper',
yref: 'paper',
x: 1,
xanchor: 'left',
y: 0,
yanchor: 'top',
text: '<b>Y axis</b> label',
showarrow: false,
},
],
});
CSP:
<meta
http-equiv="Content-Security-Policy"
content="default-src 'self'; img-src 'self' data: blob:; style-src 'self' 'sha256-jehvI5/Zi1PSH21Fi6ZfQYAtiGucyVGUH4ziRLU+Bfc=';"
/>
(NOTE: because of how the Vite dev server works, I need to include the sha256 checksum of the plotly-3.0.1.css file, in a production build it wouldn't be necessary.)
Expected result:
I produced this image by commenting out the CSP meta tag in the reproduction code linked to above.
Actual result:
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされた Vue 3 の再現例と plotly.css の組み込みから始め、提供された CSP の下で Plotly.newPlot が タグを含む注釈テキストをどのようにレンダリングするかを追跡します。再現例で動作を検証し、厳格な CSP に違反することなく太字の注釈テキストがレンダリングされることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript
- 領域
- data-visualization, frontend, security
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100