Fix Checkmarx XSS Vulnerabilities exprees js
I always see checkmarx XSS Vulnerabilities in exprees router, Not sure what to use other function to fix it.I used express validator but no luck so far.
const express = require("express");
const router = express.Router();
const { body, validationResult } = require("express-validator");
router.post(
`/testData`,
body("empName").trim().escape().not().isEmpty(),
async (req, res, next) => {
try {
//getting checkmarx xss reflected vulnerability at req.body
const callTags = req.body
const errors = validationResult(req);
if (!errors.isEmpty()) {
return res.status(400).json({ errors: errors.array() });
}
res.status(response.statusCode).json(''hello);
} catch (ex) {
next(ex);
}
}
);
module.exports = router;
}
from Recent Questions - Stack Overflow https://ift.tt/3i7o4Qe
https://ift.tt/eA8V8J
Comments
Post a Comment