eslint-plugin-mongodb-security 8.2.0 โ 8.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +51 -71
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
|
|
17
17
|
## Description
|
|
18
18
|
|
|
19
|
-
This plugin
|
|
19
|
+
This plugin provides Security rules for MongoDB queries and interactions (NoSQL injection).
|
|
20
|
+
By using this plugin, you can proactively identify and mitigate security risks across your entire codebase.
|
|
20
21
|
|
|
21
22
|
## Philosophy
|
|
22
23
|
|
|
@@ -24,19 +25,18 @@ This plugin is essential for securing specific MongoDB interactions, primarily f
|
|
|
24
25
|
|
|
25
26
|
## Getting Started
|
|
26
27
|
|
|
27
|
-
- To check out the [guide](https://eslint.interlace.tools/docs/mongodb-security), visit [eslint.interlace.tools](https://eslint.interlace.tools). ๐
|
|
28
|
-
- ่ฆๆฅ็ไธญๆ [ๆๅ](https://eslint.interlace.tools/docs/mongodb-security), ่ฏท่ฎฟ้ฎ [eslint.interlace.tools](https://eslint.interlace.tools). ๐
|
|
29
|
-
- [๊ฐ์ด๋](https://eslint.interlace.tools/docs/mongodb-security) ๋ฌธ์๋ [eslint.interlace.tools](https://eslint.interlace.tools)์์ ํ์ธํ์ค ์ ์์ต๋๋ค. ๐
|
|
30
|
-
- [ใฌใคใ](https://eslint.interlace.tools/docs/mongodb-security)ใฏ [eslint.interlace.tools](https://eslint.interlace.tools)ใงใ็ขบ่ชใใ ใใใ ๐
|
|
31
|
-
- Para ver la [guรญa](https://eslint.interlace.tools/docs/mongodb-security), visita [eslint.interlace.tools](https://eslint.interlace.tools). ๐
|
|
32
|
-
- ููุงุทูุงุน ุนูู [ุงูุฏููู](https://eslint.interlace.tools/docs/mongodb-security)ุ ูู
ุจุฒูุงุฑุฉ [eslint.interlace.tools](https://eslint.interlace.tools). ๐
|
|
28
|
+
- To check out the [guide](https://eslint.interlace.tools/docs/security/plugin-mongodb-security), visit [eslint.interlace.tools](https://eslint.interlace.tools). ๐
|
|
29
|
+
- ่ฆๆฅ็ไธญๆ [ๆๅ](https://eslint.interlace.tools/docs/security/plugin-mongodb-security), ่ฏท่ฎฟ้ฎ [eslint.interlace.tools](https://eslint.interlace.tools). ๐
|
|
30
|
+
- [๊ฐ์ด๋](https://eslint.interlace.tools/docs/security/plugin-mongodb-security) ๋ฌธ์๋ [eslint.interlace.tools](https://eslint.interlace.tools)์์ ํ์ธํ์ค ์ ์์ต๋๋ค. ๐
|
|
31
|
+
- [ใฌใคใ](https://eslint.interlace.tools/docs/security/plugin-mongodb-security)ใฏ [eslint.interlace.tools](https://eslint.interlace.tools)ใงใ็ขบ่ชใใ ใใใ ๐
|
|
32
|
+
- Para ver la [guรญa](https://eslint.interlace.tools/docs/security/plugin-mongodb-security), visita [eslint.interlace.tools](https://eslint.interlace.tools). ๐
|
|
33
|
+
- ููุงุทูุงุน ุนูู [ุงูุฏููู](https://eslint.interlace.tools/docs/security/plugin-mongodb-security)ุ ูู
ุจุฒูุงุฑุฉ [eslint.interlace.tools](https://eslint.interlace.tools). ๐
|
|
33
34
|
|
|
34
35
|
```bash
|
|
35
36
|
npm install eslint-plugin-mongodb-security --save-dev
|
|
36
37
|
```
|
|
37
38
|
|
|
38
39
|
## Usage Examples
|
|
39
|
-
|
|
40
40
|
### Prevent NoSQL Injection (`no-operator-injection`)
|
|
41
41
|
|
|
42
42
|
```javascript
|
|
@@ -60,7 +60,6 @@ User.find({ name: { $eq: sanitize(userInput) } });
|
|
|
60
60
|
---
|
|
61
61
|
|
|
62
62
|
## โ๏ธ Configuration Presets
|
|
63
|
-
|
|
64
63
|
| Preset | Description |
|
|
65
64
|
| :------------ | :------------------------------------------------ |
|
|
66
65
|
| `recommended` | Critical rules as errors, high as warnings |
|
|
@@ -68,7 +67,6 @@ User.find({ name: { $eq: sanitize(userInput) } });
|
|
|
68
67
|
| `mongoose` | Specialized rules for Mongoose ODM usage patterns |
|
|
69
68
|
|
|
70
69
|
## ๐ Supported Libraries
|
|
71
|
-
|
|
72
70
|
| Library | npm | Downloads | Detection |
|
|
73
71
|
| ---------- | ------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | ---------------------------- |
|
|
74
72
|
| `mongodb` | [](https://www.npmjs.com/package/mongodb) | [](https://www.npmjs.com/package/mongodb) | Injection, Unbounded Queries |
|
|
@@ -78,77 +76,59 @@ User.find({ name: { $eq: sanitize(userInput) } });
|
|
|
78
76
|
|
|
79
77
|
---
|
|
80
78
|
|
|
81
|
-
## AI-Optimized Messages
|
|
82
|
-
|
|
83
|
-
This plugin is optimized for ESLint's [Model Context Protocol (MCP)](https://eslint.org/docs/latest/use/mcp), enabling AI assistants like **Cursor**, **GitHub Copilot**, and **Claude** to:
|
|
84
|
-
|
|
85
|
-
- Understand the exact vulnerability type via CWE references
|
|
86
|
-
- Apply the correct fix using structured guidance
|
|
87
|
-
- Provide educational context to developers
|
|
88
|
-
|
|
89
|
-
```json
|
|
90
|
-
// .cursor/mcp.json
|
|
91
|
-
{
|
|
92
|
-
"mcpServers": {
|
|
93
|
-
"eslint": {
|
|
94
|
-
"command": "npx",
|
|
95
|
-
"args": ["@eslint/mcp@latest"]
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
By providing this structured context (CWE, OWASP, Fix), we enable AI tools to **reason** about the security flaw rather than hallucinating. This allows Copilot/Cursor to suggest the _exact_ correct fix immediately.
|
|
102
|
-
|
|
103
79
|
## Rules
|
|
104
80
|
|
|
105
81
|
**Legend**
|
|
106
82
|
|
|
107
|
-
| Icon | Description
|
|
108
|
-
|
|
|
109
|
-
|
|
|
110
|
-
|
|
|
111
|
-
|
|
|
112
|
-
|
|
|
113
|
-
|
|
|
114
|
-
|
|
115
|
-
| Rule
|
|
116
|
-
|
|
|
117
|
-
| [
|
|
118
|
-
| [
|
|
119
|
-
| [
|
|
120
|
-
| [
|
|
121
|
-
| [
|
|
122
|
-
| [
|
|
123
|
-
| [
|
|
124
|
-
| [
|
|
125
|
-
| [
|
|
126
|
-
| [
|
|
127
|
-
| [
|
|
128
|
-
| [
|
|
129
|
-
| [
|
|
130
|
-
| [
|
|
131
|
-
| [
|
|
132
|
-
| [
|
|
83
|
+
| Icon | Description |
|
|
84
|
+
| :---: | :--- |
|
|
85
|
+
| ๐ผ | **Recommended**: Included in the recommended preset. |
|
|
86
|
+
| โ ๏ธ | **Warns**: Set towarn in recommended preset. |
|
|
87
|
+
| ๐ง | **Auto-fixable**: Automatically fixable by the `--fix` CLI option. |
|
|
88
|
+
| ๐ก | **Suggestions**: Providing code suggestions in IDE. |
|
|
89
|
+
| ๐ซ | **Deprecated**: This rule is deprecated. |
|
|
90
|
+
|
|
91
|
+
| Rule | CWE | OWASP | CVSS | Description | ๐ผ | โ ๏ธ | ๐ง | ๐ก | ๐ซ |
|
|
92
|
+
| :--- | :---: | :---: | :---: | :--- | :---: | :---: | :---: | :---: | :---: |
|
|
93
|
+
| [no-bypass-middleware](https://eslint.interlace.tools/docs/security/plugin-mongodb-security/rules/no-bypass-middleware) | | | | ESLint rule documentation for no-bypass-middleware | | | | | |
|
|
94
|
+
| [no-debug-mode-production](https://eslint.interlace.tools/docs/security/plugin-mongodb-security/rules/no-debug-mode-production) | | | | ESLint rule documentation for no-debug-mode-production | | | | | |
|
|
95
|
+
| [no-hardcoded-connection-string](https://eslint.interlace.tools/docs/security/plugin-mongodb-security/rules/no-hardcoded-connection-string) | | | | ESLint rule documentation for no-hardcoded-connection-string | | | | | |
|
|
96
|
+
| [no-hardcoded-credentials](https://eslint.interlace.tools/docs/security/plugin-mongodb-security/rules/no-hardcoded-credentials) | | | | ESLint rule documentation for no-hardcoded-credentials | | | | | |
|
|
97
|
+
| [no-operator-injection](https://eslint.interlace.tools/docs/security/plugin-mongodb-security/rules/no-operator-injection) | | | | ESLint rule documentation for no-operator-injection | | | | | |
|
|
98
|
+
| [no-select-sensitive-fields](https://eslint.interlace.tools/docs/security/plugin-mongodb-security/rules/no-select-sensitive-fields) | | | | ESLint rule documentation for no-select-sensitive-fields | | | | | |
|
|
99
|
+
| [no-unbounded-find](https://eslint.interlace.tools/docs/security/plugin-mongodb-security/rules/no-unbounded-find) | | | | ESLint rule documentation for no-unbounded-find | | | | | |
|
|
100
|
+
| [no-unsafe-populate](https://eslint.interlace.tools/docs/security/plugin-mongodb-security/rules/no-unsafe-populate) | | | | ESLint rule documentation for no-unsafe-populate | | | | | |
|
|
101
|
+
| [no-unsafe-query](https://eslint.interlace.tools/docs/security/plugin-mongodb-security/rules/no-unsafe-query) | | | | ESLint rule documentation for no-unsafe-query | | | | | |
|
|
102
|
+
| [no-unsafe-regex-query](https://eslint.interlace.tools/docs/security/plugin-mongodb-security/rules/no-unsafe-regex-query) | | | | ESLint rule documentation for no-unsafe-regex-query | | | | | |
|
|
103
|
+
| [no-unsafe-where](https://eslint.interlace.tools/docs/security/plugin-mongodb-security/rules/no-unsafe-where) | | | | ESLint rule documentation for no-unsafe-where | | | | | |
|
|
104
|
+
| [require-auth-mechanism](https://eslint.interlace.tools/docs/security/plugin-mongodb-security/rules/require-auth-mechanism) | | | | ESLint rule documentation for require-auth-mechanism | | | | | |
|
|
105
|
+
| [require-lean-queries](https://eslint.interlace.tools/docs/security/plugin-mongodb-security/rules/require-lean-queries) | | | | ESLint rule documentation for require-lean-queries | | | | | |
|
|
106
|
+
| [require-projection](https://eslint.interlace.tools/docs/security/plugin-mongodb-security/rules/require-projection) | | | | ESLint rule documentation for require-projection | | | | | |
|
|
107
|
+
| [require-schema-validation](https://eslint.interlace.tools/docs/security/plugin-mongodb-security/rules/require-schema-validation) | | | | ESLint rule documentation for require-schema-validation | | | | | |
|
|
108
|
+
| [require-tls-connection](https://eslint.interlace.tools/docs/security/plugin-mongodb-security/rules/require-tls-connection) | | | | ESLint rule documentation for require-tls-connection | | | | | |
|
|
109
|
+
|
|
110
|
+
## ๐ Related ESLint Plugins
|
|
133
111
|
|
|
134
112
|
Part of the **Interlace ESLint Ecosystem** โ AI-native security plugins with LLM-optimized error messages:
|
|
135
113
|
|
|
136
|
-
| Plugin
|
|
137
|
-
|
|
|
138
|
-
| [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding)
|
|
139
|
-
| [`eslint-plugin-pg`](https://www.npmjs.com/package/eslint-plugin-pg)
|
|
140
|
-
| [`eslint-plugin-crypto`](https://www.npmjs.com/package/eslint-plugin-crypto)
|
|
141
|
-
| [`eslint-plugin-jwt`](https://www.npmjs.com/package/eslint-plugin-jwt)
|
|
142
|
-
| [`eslint-plugin-browser-security`](https://www.npmjs.com/package/eslint-plugin-browser-security)
|
|
143
|
-
| [`eslint-plugin-express-security`](https://www.npmjs.com/package/eslint-plugin-express-security)
|
|
144
|
-
| [`eslint-plugin-lambda-security`](https://www.npmjs.com/package/eslint-plugin-lambda-security)
|
|
145
|
-
| [`eslint-plugin-nestjs-security`](https://www.npmjs.com/package/eslint-plugin-nestjs-security)
|
|
146
|
-
| [`eslint-plugin-
|
|
114
|
+
| Plugin | Downloads | Description |
|
|
115
|
+
| :--- | :---: | :--- |
|
|
116
|
+
| [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding) | [](https://www.npmjs.com/package/eslint-plugin-secure-coding) | General security rules & OWASP guidelines. |
|
|
117
|
+
| [`eslint-plugin-pg`](https://www.npmjs.com/package/eslint-plugin-pg) | [](https://www.npmjs.com/package/eslint-plugin-pg) | PostgreSQL security & best practices. |
|
|
118
|
+
| [`eslint-plugin-crypto`](https://www.npmjs.com/package/eslint-plugin-crypto) | [](https://www.npmjs.com/package/eslint-plugin-crypto) | NodeJS Cryptography security rules. |
|
|
119
|
+
| [`eslint-plugin-jwt`](https://www.npmjs.com/package/eslint-plugin-jwt) | [](https://www.npmjs.com/package/eslint-plugin-jwt) | JWT security & best practices. |
|
|
120
|
+
| [`eslint-plugin-browser-security`](https://www.npmjs.com/package/eslint-plugin-browser-security) | [](https://www.npmjs.com/package/eslint-plugin-browser-security) | Browser-specific security & XSS prevention. |
|
|
121
|
+
| [`eslint-plugin-express-security`](https://www.npmjs.com/package/eslint-plugin-express-security) | [](https://www.npmjs.com/package/eslint-plugin-express-security) | Express.js security hardening rules. |
|
|
122
|
+
| [`eslint-plugin-lambda-security`](https://www.npmjs.com/package/eslint-plugin-lambda-security) | [](https://www.npmjs.com/package/eslint-plugin-lambda-security) | AWS Lambda security best practices. |
|
|
123
|
+
| [`eslint-plugin-nestjs-security`](https://www.npmjs.com/package/eslint-plugin-nestjs-security) | [](https://www.npmjs.com/package/eslint-plugin-nestjs-security) | NestJS security rules & patterns. |
|
|
124
|
+
| [`eslint-plugin-mongodb-security`](https://www.npmjs.com/package/eslint-plugin-mongodb-security) | [](https://www.npmjs.com/package/eslint-plugin-mongodb-security) | MongoDB security best practices. |
|
|
125
|
+
| [`eslint-plugin-vercel-ai-security`](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | [](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | Vercel AI SDK security hardening. |
|
|
126
|
+
| [`eslint-plugin-import-next`](https://www.npmjs.com/package/eslint-plugin-import-next) | [](https://www.npmjs.com/package/eslint-plugin-import-next) | Next-gen import sorting & architecture. |
|
|
147
127
|
|
|
148
128
|
## ๐ License
|
|
149
129
|
|
|
150
130
|
MIT ยฉ [Ofri Peretz](https://github.com/ofri-peretz)
|
|
151
131
|
|
|
152
132
|
<p align="center">
|
|
153
|
-
<a href="https://eslint.interlace.tools/docs/mongodb-security"><img src="https://eslint.interlace.tools/images/og-mongodb-security.png" alt="ESLint Interlace Plugin" width="
|
|
154
|
-
</p>
|
|
133
|
+
<a href="https://eslint.interlace.tools/docs/security/plugin-mongodb-security"><img src="https://eslint.interlace.tools/images/og-mongodb-security.png" alt="ESLint Interlace Plugin" width="100%" /></a>
|
|
134
|
+
</p>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-mongodb-security",
|
|
3
|
-
"version": "8.2.
|
|
3
|
+
"version": "8.2.2",
|
|
4
4
|
"description": "Security-focused ESLint plugin for MongoDB & Mongoose. Detects NoSQL injection, operator attacks, credential exposure, and ODM-specific vulnerabilities with AI-optimized fix guidance.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
},
|
|
18
18
|
"author": "Ofri Peretz <ofriperetzdev@gmail.com>",
|
|
19
19
|
"license": "MIT",
|
|
20
|
-
"homepage": "https://github.com/ofri-peretz/eslint/
|
|
20
|
+
"homepage": "https://github.com/ofri-peretz/eslint/tree/main/packages/eslint-plugin-mongodb-security#readme",
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
23
|
-
"url": "
|
|
23
|
+
"url": "https://github.com/ofri-peretz/eslint",
|
|
24
24
|
"directory": "packages/eslint-plugin-mongodb-security"
|
|
25
25
|
},
|
|
26
26
|
"bugs": {
|