CDATA escaping for inline <script> and <style> tags
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
調査の方向性
Start by tracing the AST and renderer paths used for inline style elements and the proposed script helper, focusing on the Raw behavior described in the issue. Compare the safety check in blaze-markup's Text renderer, then verify that special characters render correctly while closing-tag sequences cannot produce invalid HTML or XSS.
索引モデルが issue の本文から書いたものです。
説明
#3 accidentally introduced a regression wrt. to CSS rendering. <script> and <style> tags are special in HTML, as they are encoded as CDATA. That essentially means – no escaping, but closing tag can't appear in the payload content and HTML does not provide a way to escape this.
At the moment:
<style>elements generated by web-view use regular text escaping, thus, if they contain any of escaped characters (<>&"' etc.) rendered CSS will be incorrect,<script>element that we don't have a helper now will: either cause invalid JS to be rendered (iftextis used) or invalid HTML (with the risk of opening XSS vulnerability) ifrawis used – the latter was also the case for CSS before #3 was merged.
For example, addClass $ cls "test" & prop "background" ("url('https://picsum.photos/200/300?random=1&foo=2=bar')" :: Text)) will generate incorrect result:
<style type='text/css'>
.empty { background:url('https://picsum.photos/200/300?random=1&foo=2=bar') }
</style>
Potential solution could be to introduce External to AST, which would be always the same as Raw but would refuse to include any </ sequence which would prevent XSS/invalid HTML. This is what blaze-markup does for these tags.
Trivia: Historically, people would split string literals in JS payloads to "escape" them, e.g.
<script>document.write('<scr'+'ipt type="text/javascript" src="http://example.com/some.js"></sc'+'ript>');</script>
- 主要言語
- Haskell
- スター
- 56
- フォーク
- 7
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
seanhess/atomic-css のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 55/100
seanhess/atomic-css#30 · コメント 3 件 ·
seanhess/atomic-css の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
IntersectMBO/cardano-ledger#6276 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
OpenZeppelin/canton-contracts#92 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
hasura/graphql-engine#10954 ·
メンテナーはふだん 1 日以内に返信