1.2.9 • Published 5 years ago

eslint-plugin-weblint-security v1.2.9

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

eslint-plugin-weblint-security

npm version Downloads/month

Additional ESLint security rules for Javascript, React and Node.js / Express!

šŸ’æ Installation

Install ESLint either locally or globally. (Note that locally, per project, is strongly preferred)

$ npm install --save-dev eslint eslint-plugin-weblint-security
  • Requires Node.js >=14.4.0
  • Requires ESLint >=7.2.0
  • Requires ES-Parser >=2020

šŸ”§ Setup & Usage

Include Weblint security plugin in your .eslintrc.json configuration file ("env" required*):

{
    "env": {
        "browser": true,
        "es2020": true
    },
    "plugins": [
        "weblint-security"
    ].
    "extends": [
        "eslint:recommended",
        "plugin:weblint-security/recommended"
    ]
}

React support

For React projects, include the React specific rules and configurations:

{
    "env": {
        "browser": true,
        "es2020": true
    },
    "parserOptions": {
        "sourceType": "module"
    },
    "parser": "babel-eslint",
    "plugins": [
        "weblint-security"
    ],
    "extends": [
        "eslint:recommended",
        "plugin:weblint-security/recommended",
        "plugin:weblint-security/react"
    ]
}

Node.js support (including Express.js security aspects)

For Node.js projects, include the Node.js specific rules and configurations:

{
    "env": {
        "node": true
    },
    "parser": "babel-eslint",
    "plugins": [
        "weblint-security"
    ],
    "extends": [
        "eslint:recommended",
        "plugin:weblint-security/recommended",
        "plugin:weblint-security/nodejs"
    ]
}

šŸ“– Rules

āœ’ļø - the mark of fixable rules. Use eslint --fix . to apply all available fixes to your project.

Recommended base rules (@/recommended)

Rule IDDescription
no-href-and-src-inline-xssDisallows unescaped variables of uncertain origin from href and src attributes, due to the concern that they might originate from user input.āœ’ļø

React specific rules (@/react)

Rule IDDescription
no-href-and-src-inline-xss-reactDisallows unescaped variables of uncertain origin from href and src JSX attributes, due to the concern that they might originate from user input.āœ’ļø

Node.js specific rules (@/nodejs)

Rule IDDescription
detect-sql-injectionDetect the usage of SQL queries that might be vulnerable to SQL Injections.
detect-missing-helmetDisallow use of ExpressJS applications without the use of Helmet.js defaults, due to the concern that the HTTP headers might be insecurely configured.āœ’ļø

ā¤ļø Contributions

We welcome contributions!

Please use GitHub's Issues/PRs.

Please make sure any contributions are covered within the tests, or that new tests are supplied for the contribution.

Testing the rules

To run the tests, use: npm test

Test coverage is achieved through the set of test files, located at: /tests/test-files/<relevant rule-name>/

All test files are prefixed with one of the following:

  • valid_ for files that should give no output. Useful for testing false positives and soundness.

  • invalid_ for files that should give some output. Useful for testing use-cases and completeness.

  • fixed_ for files that contain the output of applying eslint --fix to some invalid_ file.

1.2.8

5 years ago

1.2.9

5 years ago

1.2.7

5 years ago

1.2.6

5 years ago

1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.0

5 years ago

1.1.9

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago