CDATA escaping for inline <script> and <style> tags
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
#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>
- Ngôn ngữ chính
- Haskell
- Star
- 56
- Fork
- 7
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
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 seanhess/atomic-css
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 55/100
seanhess/atomic-css#30 · 3 bình luận ·
Tất cả issue của seanhess/atomic-css
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
IntersectMBO/cardano-ledger#6276 ·
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 82/100
OpenZeppelin/canton-contracts#92 ·
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 78/100
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 65/100
hasura/graphql-engine#10954 ·
Maintainer thường phản hồi trong vòng 1 ngày