React Docs
Learn
Guides
Reference
Explanation
Examples
Community
⌘K
Sections
Sections
Learn
Guides
Reference
Explanation
Examples
Community
🇨🇳
简体中文
指南
安全
Security
React 默认对 XSS 有一定防护,但安全是系统性的:输入、输出、依赖与部署链路都要考虑。
TL;DR
不要拼接 HTML;必须时使用可信的消毒(sanitize)与白名单。
为第三方脚本、内联脚本制定 CSP 策略并逐步收紧。
依赖升级与漏洞扫描要进入常规流程。
这篇文章有帮助吗?
有帮助
没帮助
Previous / Next
Previous
Performance
Next
Accessibility
Related Links
Reference:API 细节对照
Learn:快速上手与基础概念
Examples:用代码验证理解