React DOM escapes any values
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 11.8k
- 派生
- 7.9k
- 平均合并
- 1 天 11 小时
- 30 天内合并 PR
- 11
描述
I have discussed this particular sentence with a colleague:
By default, React DOM escapes any values embedded in JSX before rendering them. Thus it ensures that you can never inject anything that’s not explicitly written in your application. Everything is converted to a string before being rendered.
https://reactjs.org/docs/introducing-jsx.html#jsx-prevents-injection-attacks
Specific these two quotes: "React DOM escapes any values embedded in JSX before rendering them" and "Everything is converted to a string before being rendered"
As far as we know, everything is assigned via a Text-node and not escaped as the first sentence describes.
Mimicked example
const test = `<script>console.log("My log")</script>`;
let body = document.querySelector('body');
let content = new Text(test);
body.appendChild(content);
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 issue 中链接的“JSX Prevents Injection Attacks”部分开始,并根据所描述的 Text-node 行为核实其中引用的两项说法。仅在措辞不准确时更新文档,并确保修订后的说明准确描述 JSX 值是如何渲染的。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, react
- 领域
- documentation
- Issue 类型
- 文档
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100