2.1.13 • Published 1 year ago

eslint-plugin-no-credentials v2.1.13

Weekly downloads
187
License
MIT
Repository
github
Last release
1 year ago

eslint-plugin-no-credentials

MIT License Build Status

NPM status

An ESlint plugin checking for any hardcoded credentials like a password or a token.

This library detects credentials hardcoded in a JS string (no matter whether it's defined with apostrophes, quotation marks or it's a template string) or a JS comment.

However, it doesn't check non-JS files like JSON or txt.

The percentage of found hardcoded credentials depends on applied params which should be chosen according to the code in a given project.

I recommend using additionally a spellchecking tool like that as the credentials are usually strings not matching any word found in a dictionary.

how to install?

yarn add --dev eslint-plugin-no-credentials

or

npm i --save-dev eslint-plugin-no-credentials

how to use?

In your .eslintrc file add "no-credentials" to the plugins section:

  "plugins": [
    "no-credentials"
  ],

and the no-credentials/no-credentials rule with the chosen params to that file:

    "no-credentials/no-credentials": [
      "error",
      {
        delimiters: [" ", "/", "-", "_", "."],
        maximumEntropy: 8,
        minimumWordLength: 5,
        shouldSplitCamelCase: true,
      },
    ],

Possible params:

  • delimiters (default [' ']): delimiters used to split each string into words so for each word, the entropy is calculated separately
  • minimumNumberOfWords (default 0): if the number of words in a given string is less than this param, the entire string is treated as one word
  • minimumWordLength (default 1): if a given word is shorter than this param, it's concatenated to the next word
  • maximumEntropy (default 5): maximum tolerated entropy for each word
  • shouldSplitCamelCase (default false): whether a camelCase string should be split into separate words

In order to have a better understanding, how these params work, you can read the tests.

2.1.13

1 year ago

2.1.12

1 year ago

2.1.11

1 year ago

2.1.9

2 years ago

2.1.10

2 years ago

2.1.8

3 years ago

2.1.7

3 years ago

2.1.6

3 years ago

2.1.5

3 years ago

2.1.4

3 years ago

2.1.3

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.9

4 years ago

2.0.8

4 years ago

2.0.6

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

1.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.1

4 years ago