Description
oxlint-plugin-mongodb-security is the oxlint and Vite+ name for eslint-plugin-mongodb-security. It carries the same rules under the same IDs (mongodb-security/<rule>), always at the same version, because it re-exports that package rather than copying it. Installing it does not install ESLint.
Covered natively by oxlint
None of these 16 rules has an oxlint built-in equivalent. Every rule here is new to oxlint.
- Why — a linter nobody reads protects nothing. We would rather miss a finding
than spend your attention on one that was never real.
- How — evidence, not names. A rule fires on what the code does, resolved
through the AST and ESLint's own scope analysis.
- What — every finding carries its fix, in prose for a human and as structured
JSON for an agent. Security rules add a CWE mapping and, where assigned, a CVSS score.
That trade costs recall, and we measure it:
methodology
· results
· a false positive is a bug.
Getting Started
npm install oxlint-plugin-mongodb-security --save-dev
Vite+
// vite.config.ts
import { defineConfig } from 'vite-plus';
export default defineConfig({
lint: {
jsPlugins: ['oxlint-plugin-mongodb-security'],
rules: {
'mongodb-security/no-debug-mode-production': 'error',
'mongodb-security/no-hardcoded-connection-string': 'error',
'mongodb-security/no-hardcoded-credentials': 'error',
'mongodb-security/no-operator-injection': 'error',
'mongodb-security/no-unsafe-populate': 'error',
'mongodb-security/no-unsafe-query': 'error',
'mongodb-security/no-unsafe-regex-query': 'error',
'mongodb-security/no-unsafe-where': 'error',
},
},
});
oxlint
{
"jsPlugins": ["oxlint-plugin-mongodb-security"],
"rules": {
"mongodb-security/no-debug-mode-production": "error",
"mongodb-security/no-hardcoded-connection-string": "error",
"mongodb-security/no-hardcoded-credentials": "error",
"mongodb-security/no-operator-injection": "error",
"mongodb-security/no-unsafe-populate": "error",
"mongodb-security/no-unsafe-query": "error",
"mongodb-security/no-unsafe-regex-query": "error",
"mongodb-security/no-unsafe-where": "error"
}
}
These are the rules the plugin recommends (💼 in the table below).
ESLint
Install eslint-plugin-mongodb-security instead. It has the same rules, plus presets for ESLint's flat config.
📦 Compatibility
| Package |
Version |
| oxlint |
verified on 1.94.0: CI loads every rule ID through jsPlugins |
| Vite+ |
lint.jsPlugins in vite.config.ts |
| Node.js |
>=22.13.0 |
Rules
Legend
| Icon |
Description |
| 💼 |
Recommended: Included in the recommended preset. |
| ⚠️ |
Warns: Set to warn in recommended preset. |
| 🔧 |
Auto-fixable: Automatically fixable by the --fix CLI option. |
| 💡 |
Suggestions: Providing code suggestions in IDE. |
| 🚫 |
Deprecated: This rule is deprecated. |
| 🟢 |
Type-unaware: AST-only, runs in oxlint JS-plugin tier. |
| 🟡 |
Type-aware (refining): pure-AST primary path; types refine precision. |
| 🟠 |
Type-aware (graceful): requires TS program; silent without it. |
| Rule |
CWE |
OWASP |
CVSS |
Description |
🧠 |
💼 |
⚠️ |
🔧 |
💡 |
🚫 |
| no-bypass-middleware |
CWE-284 |
A01:2021 |
|
Detects Mongoose operations that bypass middleware hooks (pre/post hooks). |
🟢 |
|
⚠️ |
|
|
|
| no-debug-mode-production |
CWE-489 |
A05:2021 |
|
Detects Mongoose debug mode that could expose sensitive query information in production. |
🟢 |
💼 |
|
|
💡 |
|
| no-hardcoded-connection-string |
CWE-798 |
A07:2021 |
|
Detects hardcoded MongoDB connection strings containing credentials in source code. |
🟢 |
💼 |
|
|
|
|
| no-hardcoded-credentials |
CWE-798 |
A07:2021 |
|
Detects hardcoded MongoDB authentication credentials in connection options. |
🟢 |
💼 |
|
|
|
|
| no-operator-injection |
CWE-943 |
A03:2021 |
|
Detects MongoDB operator injection attacks where user input is passed directly as query values, allowing at… |
🟢 |
💼 |
|
|
|
|
| no-select-sensitive-fields |
CWE-200 |
A01:2021 |
|
Detects queries that may return sensitive fields like passwords, tokens, or API keys. |
🟢 |
|
⚠️ |
|
|
|
| no-unbounded-find |
CWE-400 |
A04:2021 |
|
Requires limit() on find queries to prevent resource exhaustion from unbounded result sets. |
🟢 |
|
⚠️ |
|
💡 |
|
| no-unsafe-populate |
CWE-943 |
A03:2021 |
|
Detects user-controlled populate() paths that could lead to data exposure or injection. |
🟢 |
💼 |
|
|
|
|
| no-unsafe-query |
CWE-943 |
A03:2021 |
|
Prevents NoSQL injection by detecting direct use of user input in MongoDB query objects. |
🟢 |
💼 |
|
|
💡 |
|
| no-unsafe-regex-query |
CWE-400 |
A03:2021 |
|
Detects user input in MongoDB $regex operators that could cause ReDoS (Regular Expression Denial of Service… |
🟢 |
💼 |
|
|
|
|
| no-unsafe-where |
CWE-943 |
A01:2021 |
|
Prevents use of the dangerous $where operator which executes JavaScript on the MongoDB server, enabling Rem… |
🟢 |
💼 |
|
|
|
|
| require-auth-mechanism |
CWE-287 |
A07:2021 |
|
Requires explicit authentication mechanism specification for MongoDB connections. |
🟢 |
|
⚠️ |
|
|
|
| require-lean-queries |
CWE-400 |
A04:2021 |
|
Suggests using .lean() for read-only Mongoose queries to reduce memory usage. |
🟢 |
|
|
|
💡 |
|
| require-projection |
CWE-200 |
A01:2021 |
|
Requires field projection on queries to minimize data exposure. |
🟢 |
|
|
|
|
|
| require-schema-validation |
CWE-20 |
A04:2021 |
|
Requires validation options on Mongoose schema fields to prevent invalid or malicious data. |
🟢 |
|
⚠️ |
|
|
|
| require-tls-connection |
CWE-295 |
A02:2021 |
|
Requires TLS/SSL encryption for MongoDB connections in production environments. |
🟢 |
|
⚠️ |
|
💡 |
|
🔗 Related ESLint Plugins
Part of the Interlace ESLint ecosystem — AI-native rules with LLM-optimized error messages:
Security