3.0.0 • Published 17 days ago

eslint-plugin-security v3.0.0

Weekly downloads
245,997
License
Apache-2.0
Repository
github
Last release
17 days ago

eslint-plugin-security

NPM version

ESLint rules for Node Security

This project will help identify potential security hotspots, but finds a lot of false positives which need triage by a human.

Installation

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

or

yarn add --dev eslint-plugin-security

Usage

Flat config (requires eslint >= v8.23.0)

Add the following to your eslint.config.js file:

const pluginSecurity = require('eslint-plugin-security');

module.exports = [pluginSecurity.configs.recommended];

eslintrc config (deprecated)

Add the following to your .eslintrc file:

module.exports = {
  extends: ['plugin:security/recommended-legacy'],
};

Developer guide

  • Use GitHub pull requests.
  • Conventions:
  • We use our custom ESLint setup.
  • Please implement a test for each new rule and use this command to be sure the new code respects the style guide and the tests keep passing:
npm run-script cont-int

Tests

npm test

Rules

⚠️ Configurations set to warn in.\ ✅ Set in the recommended configuration.

Name                                 Description⚠️
detect-bidi-charactersDetects trojan source attacks that employ unicode bidi attacks to inject malicious code.
detect-buffer-noassertDetects calls to "buffer" with "noAssert" flag set.
detect-child-processDetects instances of "child_process" & non-literal "exec()" calls.
detect-disable-mustache-escapeDetects "object.escapeMarkup = false", which can be used with some template engines to disable escaping of HTML entities.
detect-eval-with-expressionDetects "eval(variable)" which can allow an attacker to run arbitrary code inside your process.
detect-new-bufferDetects instances of new Buffer(argument) where argument is any non-literal value.
detect-no-csrf-before-method-overrideDetects Express "csrf" middleware setup before "method-override" middleware.
detect-non-literal-fs-filenameDetects variable in filename argument of "fs" calls, which might allow an attacker to access anything on your system.
detect-non-literal-regexpDetects "RegExp(variable)", which might allow an attacker to DOS your server with a long-running regular expression.
detect-non-literal-requireDetects "require(variable)", which might allow an attacker to load and run arbitrary code, or access arbitrary files on disk.
detect-object-injectionDetects "variablekey" as a left- or right-hand assignment operand.
detect-possible-timing-attacksDetects insecure comparisons (==, !=, !== and ===), which check input sequentially.
detect-pseudoRandomBytesDetects if "pseudoRandomBytes()" is in use, which might not give you the randomness you need and expect.
detect-unsafe-regexDetects potentially unsafe regular expressions, which may take a very long time to run, blocking the event loop.
pocketrocket-commonandrei-cfn@wildberries/boilerplate-eslint-config@defencedigital/r2d2-lint-config@built/eslint-config@oscarltz/eslint@selfagencyllc/dev-toolseslint-config-seruseslint-config-happyeslint-config-neaf@paxsoftware/eslint-config@phanect/eslint-config-phanective@tomcarter17/eslint-config-typescript-react@miszo/eslint-configbreki-styleguideseslint-config-gorrioneslint-config-gekutechmichaelkohler-eslint-config-base@michaelkohler/eslint-config-base@infinitebrahmanuniverse/nolb-eslint-plugin-s@etchteam/eslinteslint-config-equips-tseslint-config-watchfuleslint-config-tyler-zeyeslint-tyler-zey@everything-registry/sub-chunk-1614@aaos/config-eslintiamphoto-ms-lintermoar-js-devildella-test-commonseslint-config-miszowheelhouse-linterwebpages-packer-librarywebpages-packer-nodeeslint-config-vave@fuchsfox/eslint-config-ff@frostbitecms/eslint-config@encoura/eslint-config@enkidevs/eslint-config-backend@engrave/eslint-config-engrave@frabbit/eslint-config@freaktechnik/eslint-config-base@enzymefinance/eslint-configvrai-client-sdk@hashaio/eslint-config-custom@hieu.van/quality-tools@imageapi/eslint-config-platform@html-validate/eslint-config@eslegant/js@etchteam/eslint-config@helloinspire/eslint-config@interaktiv/eslint-config-dia@hansin/lint-config@heise/eslint-config@integreat/ts-dev-setup@hendacorp/eslint-plugin@golovanovya/octopus@growflow/eslint-configdh-test-common-componentsreshift_npm_pluginreadable-codereview-edit-autostorybook-delavalstorage-pack@minna-ui/eslint-config@mist3rbru/eslint-config@liatrio/eslint-config@mblabs/eslint-config@linters/eslint-config-node@kaspersky/dev-tools@krknet/eslint-plugin@milesj/build-tool-config@midea-infra/eslint-config@microsoft/eslint-plugin-sdl@monstrs/config-eslint@mservicestech/eslint-config-node@oscarltz/eslint-config@ornikar/eslint-config@ggascoigne/eslint-config@fiquu/eslint-config@gipo355/eslint-config-base@flaminc/eslint-config@flaminc/eslint-plugin@fisch0920/eslint-config@goboomtown/storage-json@goboomtown/storage-mongo@goboomtown/connector-servicenow-storage@goboomtown/entities-nest@goboomtown/sdk@gravis-os/eslint-config@gravity-ui/eslint-config@mallowigi/eslint-config@hybrbase/eslint-config@newsteam/eslint@nitra/eslint-config@acmuta-research/eslint-config@rithum-ui/eslint-config@avenue-ui/eslint-configpatched@lshay/eslint-config
3.0.0

17 days ago

2.1.1

2 months ago

2.1.0

4 months ago

2.0.0

5 months ago

1.7.1

1 year ago

1.7.0

1 year ago

1.6.0

1 year ago

1.5.0

2 years ago

1.4.0

7 years ago

1.3.0

7 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago