3.0.1 • Published 1 year ago

eslint-plugin-security v3.0.1

Weekly downloads
245,997
License
Apache-2.0
Repository
github
Last release
1 year 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.

TypeScript support

Type definitions for this package are managed by DefinitelyTyped. Use @types/eslint-plugin-security for type checking.

npm install --save-dev @types/eslint-plugin-security

# OR

yarn add --dev @types/eslint-plugin-security
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-miszodh-test-common-componentsweb-ui-depswheelhouse-linterstorage-packstorybook-delavalvrai-client-sdk@bou-company/eslint-config@paxsoftware/core-boilerplate@posdim/eslint-config@preply-ds/eslint-config@runly/eslint-configeslint-config-rel1cxitsa-react-serverjssajsh-lintkeonkaonjslgs-linterlol-wad-parserlwp-tools@w3f/gatsby-theme-w3f@waldronmatt/eslint-config@warrify/eslint-config@washingtondc/eslint@wildberries/eslint-config@wildberries/eslint-config-root@wildberries/eslint-config-standart@wayofdev/eslint-config@wayofdev/eslint-config-bases@webpuppy/eslint-config@webpuppy/eslint-config-base@voxpelli/eslint-config@x4b/eslint-config@toruslabs/eslint-config-node@tomer/eslint-config@thermopylae/dev.environment@testmeshbuilder/mesh-builder@travi/eslint-config-travi@untile/eslint-config@utilz/config-eslint@vizydrop/eslint-config-vizydrop@voltiso/config.eslint@voltiso/eslint-config@voltiso/eslint-config-fast@veriown/eslint-config@validatecl/eslint-config@v2-digital/eslint-plugin-v2-linter@xenon.js/configs@yandex-cloud/eslint-config@zayne-labs/eslint-config@tembty/eslint-config@zulfikaradnan/eslint-config@atlascommunity/eslint-config@cloudflight/eslint-plugin-node@ckt1031/eslint-config@goboomtown/connector-servicenow-storage@goboomtown/entities-nest@goboomtown/sdk@goboomtown/storage-json@goboomtown/storage-mongo@golovanovya/octopus@chronoverse-eslint/presets@cinnabar-forge/eslint-plugin@grantheaslip/eslint-config@abeai/eslint-config@7sne/eslint@hansin/lint-config@gravity-ui/eslint-config@gravis-os/eslint-config
3.0.1

1 year ago

3.0.0

2 years ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

1.7.1

3 years ago

1.7.0

3 years ago

1.6.0

3 years ago

1.5.0

3 years ago

1.4.0

8 years ago

1.3.0

9 years ago

1.2.0

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago