Skip to main content
ESLint Interlace
Plugin: secure-coding

Overview

General secure coding practices and OWASP compliance for JavaScript/TypeScript

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.


Live README from GitHubfrom eslint-plugin-secure-coding/README.md, cached for 1 hour.Edit on GitHub
ESLint Interlace Logo

General secure coding practices and OWASP compliance for JavaScript/TypeScript.

NPM VersionNPM DownloadsPackage LicenseCodecovSince Dec 2025

โญ If this plugin caught a real bug for you, star the repo โ€” it's the signal that keeps these rules maintained.

Description

This plugin provides General secure coding practices and OWASP compliance for JavaScript/TypeScript.

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-secure-coding --save-dev

Add to your eslint.config.mjs โ€” one line activates 16 security rules:

import securePlugin from 'eslint-plugin-secure-coding';

export default [
  // Balanced: catches critical issues as errors, lower-confidence rules as warnings
  ...securePlugin.configs.recommended,

  // Zero-tolerance: same 16 rules, all promoted to error (good for CI gates)
  // ...securePlugin.configs['recommended-strict'],
];

Or if you use a legacy .eslintrc.json:

{
  "extends": ["plugin:secure-coding/recommended"]
}

Using recommended already? Extend your coverage with domain-specific plugins: eslint-plugin-node-security (crypto, eval, buffer) ยท eslint-plugin-jwt (JWT auth) ยท eslint-plugin-express-security (Express middleware)


Benchmarks vs competitors (CWE-798 ground truth)

no-hardcoded-credentials is part of the ILB-Flagship benchmark suite. On the labeled CWE-798 fixture set (Juliet-style: 2 vulnerable + 2 safe files, ground-truthed):

RulePrecisionRecallF1
secure-coding/no-hardcoded-credentials (ours)100%100%1.00
eslint-plugin-no-secrets/no-secrets100%50%0.67

The competitor's entropy-only detection catches the high-entropy API-key shape but misses the 15-character literal password assigned to password:. Our context-gated detection (structural patterns + credential-named-variable check + context-positive path) catches both for the right reasons.

On real OSS (vercel/ai), the competitor reports ~380 more findings than us. Those 380 are not catches we missed โ€” they're entropy false-positives on TypeScript type literals ('experimental_onLanguageModelCallStart'), error class names ('AI_ToolCallNotFoundForApprovalError'), and documentation URLs. Sampling confirmed zero are actual credentials. The corpus number is the right one to weigh; the OSS finding-count is a noise metric.

โš™๏ธ Configuration Presets

PresetDescription
recommended16 core rules โ€” critical issues as error, lower-confidence as warn
recommended-strictSame 16 rules as recommended, all promoted to error โ€” for CI gates
strictAll rules as error โ€” maximum coverage including experimental rules
owasp-top-10OWASP Top 10 Web 2021 compliance focused
owasp-mobile-top-10OWASP Mobile Top 10 2024 compliance focused

๐Ÿ“ฆ Compatibility

PackageVersion
ESLint^8.0.0 || ^9.0.0 || ^10.0.0
Node.js>=18.0.0

See the ESLint Version Support Policy โ€” current ecosystem share data, the 20% gate, and the forward-looking exception that covers v10.

Rules

Legend

IconDescription
๐Ÿ’ผ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.
RuleCWEOWASPCVSSDescription๐Ÿง ๐Ÿ’ผโš ๏ธ๐Ÿ”ง๐Ÿ’ก๐Ÿšซ
detect-non-literal-regexpCWE-400Detects RegExp(variable), which might allow an attacker to DOS your server with a long-running regular exprโ€ฆ๐ŸŸข
detect-object-injectionCWE-915Detects variable[key] as a left- or right-hand assignment operand (prototype pollution)๐ŸŸก
detect-weak-password-validationCWE-521A07:2021Detects weak password length requirements (less than 8 characters) in validation code.๐ŸŸข
no-directive-injectionCWE-94Detects directive injection vulnerabilities in template systems๐ŸŸข
no-electron-security-issuesCWE-16Detects Electron security vulnerabilities and insecure configurations๐ŸŸข
no-format-string-injectionCWE-134Detects format string injection vulnerabilities๐ŸŸข
no-graphql-injectionCWE-943Detects GraphQL injection vulnerabilities and DoS attacks๐ŸŸข๐Ÿ’ผ
no-hardcoded-credentialsCWE-798Detects hardcoded passwords, API keys, tokens, and other sensitive credentials in source code๐ŸŸข๐Ÿ’ผ
no-hardcoded-session-tokensCWE-798This rule detects hardcoded JWT tokens (starting with eyJ), Bearer tokens, and session identifiers๐ŸŸข
no-improper-sanitizationCWE-116Detects improper sanitization of user input๐ŸŸข
no-improper-type-validationCWE-1287Detects improper type validation in user input handling๐ŸŸข๐Ÿ’ผ
no-insecure-comparisonCWE-697Detects insecure comparison operators (==, !=) that can lead to type coercion vulnerabilities๐ŸŸข๐Ÿ’ผ
no-ldap-injectionCWE-90Detects LDAP injection vulnerabilities๐ŸŸข๐Ÿ’ผ
no-missing-authenticationCWE-287CWE: CWE-287๐ŸŸข๐Ÿ’ผ
no-pii-in-logsCWE-359Prevent personally identifiable information (PII) โ€” emails, SSNs, credit cards, phone numbers โ€” from reachiโ€ฆ๐ŸŸข๐Ÿ’ก
no-privilege-escalationCWE-269Detects potential privilege escalation vulnerabilities where user input is used to assign roles or permissiโ€ฆ๐ŸŸข๐Ÿ’ผ
no-redos-vulnerable-regexCWE-400ESLint Rule: no-redos-vulnerable-regex๐ŸŸข
no-sensitive-data-exposureCWE-532ESLint Rule: no-sensitive-data-exposure๐ŸŸข๐Ÿ’ผ
no-unchecked-loop-conditionCWE-400Detects unchecked loop conditions that could cause DoS๐ŸŸข
no-unlimited-resource-allocationCWE-770Detects unlimited resource allocation that could cause DoS๐ŸŸข
no-unsafe-deserializationCWE-502Detects unsafe deserialization of untrusted data๐ŸŸข๐Ÿ’ผ
no-unsafe-regex-constructionCWE-400ESLint Rule: no-unsafe-regex-construction with LLM-optimized suggestions and auto-fix capabilities๐ŸŸข
no-weak-password-recoveryCWE-640ESLint Rule: no-weak-password-recovery with LLM-optimized suggestions and auto-fix capabilities๐ŸŸข๐Ÿ’ผ
no-xpath-injectionCWE-643Detects XPath injection vulnerabilities๐ŸŸข๐Ÿ’ผ
no-xxe-injectionCWE-611Detects XML External Entity (XXE) injection vulnerabilities๐ŸŸข๐Ÿ’ผ
require-backend-authorizationCWE-602CWE: CWE-602๐ŸŸข
require-secure-defaultsCWE-1188CWE: CWE-1188๐ŸŸข

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

PluginDownloadsDescription
eslint-plugin-secure-codingdownloadsGeneral security rules & OWASP guidelines.
eslint-plugin-pgdownloadsPostgreSQL security & best practices.
eslint-plugin-node-securitydownloadsNode.js core-module security (fs, child_process, vm, crypto, Buffer).
eslint-plugin-jwtdownloadsJWT security & best practices.
eslint-plugin-browser-securitydownloadsBrowser-specific security & XSS prevention.
eslint-plugin-express-securitydownloadsExpress.js security hardening rules.
eslint-plugin-lambda-securitydownloadsAWS Lambda security best practices.
eslint-plugin-nestjs-securitydownloadsNestJS security rules & patterns.
eslint-plugin-mongodb-securitydownloadsMongoDB security best practices.
eslint-plugin-vercel-ai-securitydownloadsVercel AI SDK security hardening.
eslint-plugin-import-nextdownloadsNext-gen import sorting & architecture.

โญ Support & follow

If this plugin caught a real bug for you, star the repo โ€” stars are the signal that keeps the Interlace ESLint ecosystem maintained โ€” and follow the writeups on Dev.to for the benchmarks and security research behind these rules.

GitHub stars

๐Ÿ“„ License

MIT ยฉ Ofri Peretz

ESLint Interlace Plugin

View README.md on GitHub โ†’

On this page

No Headings