Giter VIP home page Giter VIP logo

eslint-plugin-no-secrets's People

Contributors

dependabot[bot] avatar mbfahey avatar nickdeis avatar saadbazaz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

eslint-plugin-no-secrets's Issues

question: find secrets in comments?

Hi,

I tried your plugin and it works great, at least for secrets in source code.

Is there a way to make it find secrets in comments?

Sample:

// const passwords = "admin123"     <---- HERE I forget to remove this commented line
const password = ""

BTW, maybe related, we are using TypeScript.

Thanks

[feature request] Blacklist particular statements

Description

I would like to be able to exclude strings in some statements from consideration, no matter what entropy level they have:

  • optionally exclude strings by contents
  • optionally exclude particular variables (by regexes of their names)
  • optionally exclude strings in common expressions, like import, require, className, maybe various strings of CSS-in-JS frameworks

Motivation

For example, the rule is triggered for this string:

const webpackFriendlyConsole = require('./config/webpack/webpackFriendlyConsole')

The entropy of './config/webpack/webpackFriendlyConsole' is 4.1, however it is an obvious false positive.

Possible interface

The corresponding options could look for example like this:

  'no-secrets/no-secrets': [
    'warn',
    {
      tolerance: 5,
      additionalRegexes: {},
      ignoreContent: [
        /.*some high-entropy text that is not a secret: bla bla bla.*/,
      ],
      ignoreImports: true,
      ignoreCommonjsRequires: true,
      ignoreCssClassNames: true,
      ignoreVariableNames: [/^NOT_A_SECRET_.*$/, 'highEntropySample'],
    },
  ],

Additional considerations

Although some of the blacklisting can, of course, can be achieved by selectively disabling the rule for a line or file or even adding particular files to override with this rule disabled, it would be awesome to have some sort of centralized control and additional customization, as described above.

In any case, thanks for the great plugin! ;)

continuous integration

Could you add a continuous integration in order to check easily the tests status?
E.g. TravisCI is reliable and free for Open Source.

Minimum entropy threshold

Hey,
I don't want this plugin to detect strings with entropy less than 4.3 (because those are usually not secrets for my project). How can I get that done?

upgrading dependencies

Could you upgrade dependencies?

btw. I checked require("eslint/lib/testers/rule-tester") works for eslint@5 but doesn't for eslint@6

real entropy

IMO Shannon entropy isn't a good measurement because a given string repeated 100 times has the same entropy as repeated only once.
Of course, repeating the same sequence doesn't increase much the amount of information but in some level increases.

IMO:

  • abcd -> log_2 (4) which gives 2
  • abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd (abcd repeated 100 times) -> log_2 (4 + log_2 (100)) = 3.41

https://www.shannonentropy.netmark.pl/calculate

specify a delimiter

Currently, if a given string contains many words delimited with a space, each word has a separate entropy calculated.

I want to be able to specify other delimiters as well e.g. _, -, @.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.