MongoDB (String) intrusion detector
Install with npm install --save mongo-interceptor
Require the package like you always do: var mongoInterceptor = require('mongo-interceptor');
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 escapedString
isIntrusion
: TheBoolean
to tell if anymongoDB
operators where detected and escapedinjections
: The[String]
if foundmongoDB
operators
See the interceptor-tests for further information.
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.
Returns the actual VERSION
of the library in use.