Sanitize user input in Mongoose

前端 未结 2 571
广开言路
广开言路 2021-02-19 00:49

Except for this fairly uninformative answer and another unpopular answer, I can\'t seem to find any resources about sanitizing user input using Mongoose.

There\'s a blog

2条回答
  •  悲哀的现实
    2021-02-19 01:39

    There is a new tool providing auto control of coming URL and html body data. https://www.npmjs.com/package/content-filter

    Also native escape() method might be used for to protect the database.

    Run the code snippet below to see the results.

    let a = "{$gt:25}"
    console.log(a)
    console.log(escape(a))

提交回复
热议问题