Skip to content

Commit e00dcf7

Browse files
fix(security): autofix NoSQL injection attack possible
1 parent 3c7d052 commit e00dcf7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

NoSQL Injection/mongodb.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ router.post('/customers/login', async (req, res) => {
6262
const db = client.db(config.MONGODB_DB_NAME);
6363
const customers = db.collection("customers")
6464

65-
let myobj = { email: req.body.email, password: req.body.password };
65+
let myobj = { email: { $eq: req.body.email }, password: { $eq: req.body.password } };
6666
customers.findOne(myobj, function (err, result) {
6767
if (err) throw err;
6868
db.close();

0 commit comments

Comments
 (0)