Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
给定一个由不受信任的来源生成的 SVG 文件,我需要对其进行清理,删除任何潜在的 XSS 或其他类似漏洞。理想情况下,这应该在 NodeJS 库中完成。
DOMPurify是您正在寻找的。我从未使用过它,但描述和示例表明它可以清理 SVG、HTML ......
希望能帮助到你。