我正在从事一个具有易受攻击的 MongoDB Nosql 注入的项目。
var query = "this.user == '" + req.user._id + "' && this.scooter.name.toLowerCase().includes('" + search + "')";
.........
Reservation.find({$where: query})
如何在不破坏查询的情况下过滤“搜索”参数中的用户输入?
var query = "this.user == '" + req.user._id + "' && this.scooter.name.toLowerCase().includes('" + search + "')";
query = query2.replace(/'\)/g, '');
我试过了,但没有用。