ESLint InterlaceESLint Interlace
Plugin: mongodb-security

Overview

NoSQL injection, operator attacks, and MongoDB/Mongoose security rules

Live from GitHub

This content is fetched directly from README.md on GitHub and cached for 1 hour.

AI-Optimized Security

Every rule includes CWE, OWASP, and CVSS metadata for AI assistants to provide precise, context-aware fixes.


ESLint Interlace Logo

Security rules for MongoDB queries and interactions (NoSQL injection).

NPM VersionNPM DownloadsPackage LicenseCodecovSince Dec 2025

Description

This plugin provides Security rules for MongoDB queries and interactions (NoSQL injection). By using this plugin, you can proactively identify and mitigate security risks across your entire codebase.

Philosophy

Interlace fosters strength through integration. Instead of stacking isolated rules, we interlace security directly into your workflow to create a resilient fabric of code. We believe tools should guide rather than gatekeep, providing educational feedback that strengthens the developer with every interaction.

Getting Started

npm install eslint-plugin-mongodb-security --save-dev

Usage Examples

Prevent NoSQL Injection (no-operator-injection)

// โŒ Incorrect (Vulnerable to { $ne: null })
User.findOne({ email: req.body.email, password: req.body.password });

// โœ… Correct (Safe execution)
User.findOne({ email: { $eq: email }, password: { $eq: password } });

Prevent JavaScript Injection (no-unsafe-where)

// โŒ Incorrect (Allows RCE)
User.find({ $where: `this.name === '${userInput}'` });

// โœ… Correct (Standard operators)
User.find({ name: { $eq: sanitize(userInput) } });

โš™๏ธ Configuration Presets

PresetDescription
recommendedCritical rules as errors, high as warnings
strictAll rules as errors
mongooseSpecialized rules for Mongoose ODM usage patterns

๐Ÿ“š Supported Libraries

LibrarynpmDownloadsDetection
mongodbInjection, Unbounded Queries
mongooseSchema Safety, Leans


Rules

Legend

IconDescription
๐Ÿ’ผRecommended: Included in the recommended preset.
โš ๏ธWarns: Set towarn in recommended preset.
๐Ÿ”งAuto-fixable: Automatically fixable by the --fix CLI option.
๐Ÿ’กSuggestions: Providing code suggestions in IDE.
๐ŸšซDeprecated: This rule is deprecated.
RuleCWEOWASPCVSSDescription๐Ÿ’ผโš ๏ธ๐Ÿ”ง๐Ÿ’ก๐Ÿšซ
no-bypass-middlewareESLint rule documentation for no-bypass-middleware
no-debug-mode-productionESLint rule documentation for no-debug-mode-production
no-hardcoded-connection-stringESLint rule documentation for no-hardcoded-connection-string
no-hardcoded-credentialsESLint rule documentation for no-hardcoded-credentials
no-operator-injectionESLint rule documentation for no-operator-injection
no-select-sensitive-fieldsESLint rule documentation for no-select-sensitive-fields
no-unbounded-findESLint rule documentation for no-unbounded-find
no-unsafe-populateESLint rule documentation for no-unsafe-populate
no-unsafe-queryESLint rule documentation for no-unsafe-query
no-unsafe-regex-queryESLint rule documentation for no-unsafe-regex-query
no-unsafe-whereESLint rule documentation for no-unsafe-where
require-auth-mechanismESLint rule documentation for require-auth-mechanism
require-lean-queriesESLint rule documentation for require-lean-queries
require-projectionESLint rule documentation for require-projection
require-schema-validationESLint rule documentation for require-schema-validation
require-tls-connectionESLint rule documentation for require-tls-connection

Part of the Interlace ESLint Ecosystem โ€” AI-native security plugins with LLM-optimized error messages:

PluginDownloadsDescription
eslint-plugin-secure-codingGeneral security rules & OWASP guidelines.
eslint-plugin-pgPostgreSQL security & best practices.
eslint-plugin-cryptoNodeJS Cryptography security rules.
eslint-plugin-jwtJWT security & best practices.
eslint-plugin-browser-securityBrowser-specific security & XSS prevention.
eslint-plugin-express-securityExpress.js security hardening rules.
eslint-plugin-lambda-securityAWS Lambda security best practices.
eslint-plugin-nestjs-securityNestJS security rules & patterns.
eslint-plugin-mongodb-securityMongoDB security best practices.
eslint-plugin-vercel-ai-securityVercel AI SDK security hardening.
eslint-plugin-import-nextNext-gen import sorting & architecture.

๐Ÿ“„ License

MIT ยฉ Ofri Peretz

ESLint Interlace Plugin

View README.md on GitHub โ†’

On this page

No Headings