
UMalik214428 (Community Member) asked a question.
The flaw is related to code for downloading a file after a user clicks a link. The file is fetched from my API as follows:
fetch(...)
.then((response) => {
response.blob().then((blob) => {
const url = window.URL.createObjectURL(new Blob([blob]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', `${fileName}`);
document.body.appendChild(link); // <<<--- the flaw complains about this line
link.click();
if (link.parentNode)
link.parentNode.removeChild(link);
});
})
I don't know how to fix this. Any help would be appreciated.
.png)
Hi @UMalik214428 (Community Member),
Please refer to the first answer here https://community.veracode.com/s/question/0D53n00008FULN5CAP/cwe-80-improper-neutralization-of-scriptrelated-html-tags-in-a-web-page-basic-xss-with-angular for more information.
Thank you,
Florian Walter