mongo-interceptor
v0.3.1
Published
MongoDB operator escaping, prevent NoSQL-injections
Maintainers
Readme
mongo-interceptor
MongoDB (String) intrusion detector
Installation
Install with npm install --save mongo-interceptor
Usage
Require the package like you always do: var mongoInterceptor = require('mongo-interceptor');
Methods
check()
You can check any Object, Array, or String for "harmful" mongoDB operators by calling mongoInterceptor.checkStr(possibleNOSQLInjectionString) and you will get an object in return, which contains the following information:
escaped: The escapedStringisIntrusion: TheBooleanto tell if anymongoDBoperators where detected and escapedinjections: The[String]if foundmongoDBoperators
See the interceptor-tests for further information.
setReplacer()
By default, mongo-interceptor is using the underscore (_) to escape/replace found mongoDB operators, but you can set any other replacement String you like - excluding $ itself.
Properties
VERSION
Returns the actual VERSION of the library in use.
