Giter Site home page Giter Site logo

Comments (5)

gcmurphy avatar gcmurphy commented on May 22, 2024

Just merged PR #109 that will ensure the first example does not report an error.

The second example shouldn't trigger as we only look for variables containing phrases like password, key, token or secret so 'UsernameFieldLabel' shouldn't trigger it, however the error reporting for GenDecl blocks such as that didn't reference the exact constant declaration that was causing the error, instead it was referencing the entire const ( ) block. So I fixed that in PR #110.

The test is still pretty noisy which is why it has been marked as a low confidence result. We are looking at introducing and additional entropy check (see #105) which should reduce these kinds of false positives.

from gosec.

willfaught avatar willfaught commented on May 22, 2024

from gosec.

gcmurphy avatar gcmurphy commented on May 22, 2024

Yes it would currently. There is the option to use the flag -exclude=G101 to exclude this rule.

from gosec.

gcmurphy avatar gcmurphy commented on May 22, 2024

Closing.

There isn't really a heuristic that we can use here to reduce false positives in variable naming. This test should really target things like API keys so when #105 is merged it will eliminate a large number of false positives around innocuous things like const PasswordFieldLabel = "Enter password".

In addition the option is available to exclude this test altogether via the -exclude=G101 command line option or add a // #nosec comment to the affected field. (e.g. const PasswordFieldLabel = "Enter password" // #nosec), the nosec tags are also applicable to entire blocks. (e.g. a whole block of constants).

from gosec.

willfaught avatar willfaught commented on May 22, 2024

OK, thanks.

from gosec.

Related Issues (20)

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.