# mongo-interceptor

> MongoDB operator escaping, prevent NoSQL-injections

Latest version **0.3.1** (published 2017-03-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install mongo-interceptor
pnpm add mongo-interceptor
yarn add mongo-interceptor
bun add mongo-interceptor
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.1 |
| Published | 2017-03-24 |
| First published | 2017-03-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Heinz Romirer |
| Maintainers | herom |
| Keywords | mongo, mongodb, mongo-db, nosql, nosql-injection, injection, owasp, intrusion-detection |

## Links

- npm: https://www.npmjs.com/package/mongo-interceptor
- Repository: https://github.com/herom/mongo-interceptor
- Issues: https://github.com/herom/mongo-interceptor/issues
- npm.io page: https://npm.io/package/mongo-interceptor

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 0.3.1 (latest) — 2017-03-24
- 0.3.0 — 2017-03-21
- 0.2.0 — 2017-03-16
- 0.1.0 — 2017-03-10
- 0.0.1 — 2017-03-06

## README

# mongo-interceptor
MongoDB (String) intrusion detector

[![Build Status](https://travis-ci.org/herom/mongo-interceptor.svg?branch=master)](https://travis-ci.org/herom/mongo-interceptor)

## 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 escaped `String`
- `isIntrusion`: The `Boolean` to tell if any `mongoDB` operators where detected and escaped
- `injections`: The `[String]` if found `mongoDB` operators

See the [interceptor-tests](https://github.com/herom/mongo-interceptor/blob/master/test/interceptor.js#L5-L56) 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.

---
_Source: https://npm.io/package/mongo-interceptor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
