问题描述
如何修复这个漏洞?
const options = {
...optionsImg,headers: {
...optionsImg.headers,// as an example:
'X-this-is-request-number': `${x} out of ${pics.length}`,},url: url,};
解决方法
您没有对 "
字符进行编码。这允许攻击者终止您的 HTML 属性 (value
) 并注入他们自己的 (onclick
)。正如其他人提到的,您应该使用受信任的消毒剂,但您所展示的关键漏洞是未能对引号进行编码。