Giter VIP home page Giter VIP logo

Comments (10)

oprogramador avatar oprogramador commented on June 14, 2024

Moreover, I'd like to be able to split words if a string is written with CamelCase but not if the entire string is with uppercase.

'FooBarBaz' => ['foo', 'bar', 'baz']
'FOO' => ['foo']
'FOo' => ['f', 'oo']
'FoO' => ['fo', 'o']

from eslint-plugin-no-secrets.

oprogramador avatar oprogramador commented on June 14, 2024

It could also support some options like:

  • minimum number of delimiters
if it's set to 3:
'FOO_BAR_BAZ' => ['foo', 'bar', 'baz]
'FOO_BAR' => 'foo_bar'
  • minimum number of words in a CamelCase string:
if it's set to 3:
'FooBarBaz' => ['foo', 'bar', 'baz]
'FooBar' => ['foobar']
  • minimum word length in a CamelCase string:
if it's set to 3:
'FooBarBaz' => ['foo', 'bar', 'baz]
'FoBar' => ['fobar']
'FoBarBaz' => ['fobar', 'baz']
  • maximum number for a given delimiter:
we set '@' to be a delimiter with max one time:
'[email protected]' => ['john', 'gmail.com']
'foo@bar@baz' => ['foo@bar@baz']

from eslint-plugin-no-secrets.

nickdeis avatar nickdeis commented on June 14, 2024

Hey Piotr,
Thanks for the detailed feature request and taking the time out of your day to make this project better. I think I can make the delimiter configurable since I'm just using String#split. Let me work on a design this week and I'll update this thread.
Cheers,
Nick

from eslint-plugin-no-secrets.

oprogramador avatar oprogramador commented on June 14, 2024

@nickdeis

When are you going to implement these improvements?
If you don't have enough time, I can open a PR.

from eslint-plugin-no-secrets.

nickdeis avatar nickdeis commented on June 14, 2024

Hey @oprogramador, that would be great! I'm moving this weekend so I'm kind of short on time.

from eslint-plugin-no-secrets.

oprogramador avatar oprogramador commented on June 14, 2024

@nickdeis

I wrote this plugin https://github.com/oprogramador/eslint-plugin-no-credentials

Anyway thanks for your plugin, it helped me to write mine.

from eslint-plugin-no-secrets.

nickdeis avatar nickdeis commented on June 14, 2024

Hey @oprogramador,
I've added two options to help out with false positives

  • additionalDelimiters: In addition to splitting the string by whitespace, tokens will be further split by these delimiters
  • ignoreCase: Ignores character case when calculating entropy. This could lead to some false negatives

I'm testing this over some real world scenarios. I think I might remove ignoreCase since it's causing too many false negatives. Splitting by camel case has also some false negatives. I wanted to know your thoughts on this since your feedback has been very helpful.
Cheers,
Nick

from eslint-plugin-no-secrets.

oprogramador avatar oprogramador commented on June 14, 2024

false negative - you mean a secret which isn't detected?

from eslint-plugin-no-secrets.

nickdeis avatar nickdeis commented on June 14, 2024

@oprogramador Yes. Particularly JWT. I found that I had to tune the regular expression so that it would have a certain number of lowercase afterwards. It was still helpful.

from eslint-plugin-no-secrets.

nickdeis avatar nickdeis commented on June 14, 2024

After using this, I think this feature works on all of your use cases. Closing this for now.

from eslint-plugin-no-secrets.

Related Issues (9)

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.