Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report showing XSS vulnerability even though the code is fixed. #116

Open
mahammadrafeek opened this issue Apr 5, 2024 · 2 comments
Open

Comments

@mahammadrafeek
Copy link

mahammadrafeek commented Apr 5, 2024

const { xss } = require('express-xss-sanitizer');
app.use(xss());

This code removing the html tags and scripts from the request but still the njsscan showing vulnerabilities for the below code.

router.post("/employee/data", async (req, res) => {

 const empData= await prepareEmployeeData(req.body);

 res.setHeader('Content-Type', 'application/pdf');
 res.setHeader('Content-Disposition', 'attachment; filename=result.pdf');
 res.send(empData);

});
@ajinabraham
Copy link
Owner

This is possibly a false positive, the rule thinks that req.body is reaching the response via res.send(empData);

@mahammadrafeek
Copy link
Author

@ajinabraham
Is there any way we can fix it.?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants