![](/img/trans.png)
[英]Checkmarx scan issue for express js res.send() with array response data
[英]checkmarx scan issue with the js code $(this).attr('name')
我在我的js文件中写了下面这行代码
var radio =
DOMPurify.sanitize($($.parseHTML(decodeURIComponent(encodeURIComponent($
(this).attr('name'))))).text());
并且 checkmarx 扫描在上面的行抛出以下错误
“应用程序在生成的 output 中嵌入不受信任的数据,在 com.js 的上述行中。这些不受信任的数据未经适当的清理或编码直接嵌入到 output 中,使攻击者能够将恶意代码注入 output。”
有人可以告诉我我做错了什么以及我需要做什么才能解决这个漏洞问题吗? 提前致谢
我已经实施了 DOMPurify.sanitize
我在您的代码中看到两个相互矛盾的问题。
你可以简单地把它写成:
var radio = DOMPurify.sanitize(($(this).attr('name')).text());
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.