我总是在exprees路由器中看到checkmarx XSS漏洞,不知道用什么其他函数来修复它。我使用了express验证器,但到目前为止还没有成功。
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;
}发布于 2021-09-25 19:14:52
<p>Hello, {{empName}}</p>https://stackoverflow.com/questions/69320464
复制相似问题