@noctcore/eslint-plugin-security
A bad fit if you want broad taint tracking; this plugin trades recall for reports you can trust.
Injection, path traversal, SSRF, open redirect, unsanitized HTML and timing-unsafe comparison: high-precision syntactic sinks only.
What it solves
Section titled “What it solves”A small set of sinks where a user-controlled string becomes a vulnerability: a shell command built by interpolation, a fetch URL whose host comes from a request, a redirect to an arbitrary origin, a path joined from req.params, HTML handed to dangerouslySetInnerHTML unsanitized, an HMAC signature compared with ===, a password hashed with a cheap bcrypt cost, an auth cookie written without httpOnly, secure or sameSite, a 'use server' action exported without its action client.
What it will yell at you about
Section titled “What it will yell at you about”It will yell at you rarely, and on purpose: precision is the point. Each rule matches a narrow syntactic shape and stays silent when it cannot prove the value is dynamic, so it will miss taint that flows through a helper. Treat it as a tripwire, not a security audit, and keep a real SAST tool. Five rules are exported but left out of the preset: auth-cookie-flags because a rule entering the preset is a breaking change on 1.x and it matches cookies by name, bcrypt-rounds-min for the same 1.x reason, require-path-containment because it has a high false-positive rate, require-sanitized-html because a real codebase has trusted HTML only you can list, and server-action-through-client because it needs your action-client names. It is a bad fit if you want broad taint tracking; this plugin trades recall for reports you can trust.
Install and configure
Section titled “Install and configure”npm install --save-dev @noctcore/eslint-plugin-security @typescript-eslint/parser# or: bun add -D / pnpm add -D @noctcore/eslint-plugin-security @typescript-eslint/parserThe recommended preset enables 5 of 10 rules. The rules board below builds the flat config: start from a preset, switch single rules between error and off, and copy the result.
Each rule links to its page, with the options it takes and Incorrect and Correct examples. A good first
read is no-shell-interpolation.
--fixsuggestionsneeds optionstype infoEach switch sets a rule to error or off.
session, sid, auth_token, authToken by default) must be written with httpOnly: true, secure and a valid sameSite.hash / hashSync / genSalt / genSaltSync call must not pass a literal cost below minRounds (default 10).exec/execSync, or spawn/execFile with a shell option that is not false), including through promisify(exec). Pass the program and arguments separately.=== / !== / == / != or Buffer#equals; use crypto.timingSafeEqual.createPresignedPost call must pin the upload size and Content-Type in literal Conditions.req.*) passed directly into path.join / path.resolve without a containment test on the result is a path-traversal sink.dangerouslySetInnerHTML, innerHTML, outerHTML or insertAdjacentHTML must be static markup or pass through a configured sanitizer.'use server' module every exported action must be built from a configured action client; a raw exported function bypasses input validation, error shaping and middleware.