Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gitleaks --no-git don't work anymore #2945

Closed
snaquekiller opened this issue Sep 11, 2023 · 17 comments
Closed

Gitleaks --no-git don't work anymore #2945

snaquekiller opened this issue Sep 11, 2023 · 17 comments
Labels
bug Something isn't working

Comments

@snaquekiller
Copy link

Describe the bug
Hello, when i try to pass --not-git for gitleaks argument, it's never work as long as it's git repos.

To Reproduce
Steps to reproduce the behavior:

  1. Add "--no-git" to REPOSITORY_GITLEAKS_ARGUMENTS
  2. run megalinter in git repository
  3. it's will scan the whole repo with all git commit

Expected behavior
Should not read commit.

Additional context
I suppose that the problem commit is : 7ff24de#diff-a99fcd6a981aa3d1d5a58aced014f97230d5e2f948e99cdc3f068330e3cca579

@snaquekiller snaquekiller added the bug Something isn't working label Sep 11, 2023
@nvuillam
Copy link
Member

@DariuszPorowski please could you have a look ? :)

@VictorRos
Copy link
Contributor

Hello!
I'm working with Nicolas.
He's currently in vacations, but I can follow up this issue if you have questions.
Since condition has changed, option --no-git is always removed.

@riccardos77
Copy link

riccardos77 commented Sep 28, 2023

Hello, same problem here.
Please can you tell me if there is a parameter configuration that allows to analyze only the current files and not the Git history like --no-git argument?

thanks

@nvuillam
Copy link
Member

@VictorRos @DariuszPorowski any chance you can have a look at this regression to allow --no-git to be used again? :)

@DariuszPorowski
Copy link
Contributor

@nvuillam I am on vacation now. Going back in 3 weeks.

@nvuillam
Copy link
Member

@DariuszPorowski no problem, enjoy your vacations :)

At worse i'll add a workaround with an env var :)

@riccardos77
Copy link

hello, any update for this issue? thanks

@Kurt-von-Laven
Copy link
Collaborator

Kurt-von-Laven commented Oct 28, 2023

This is not a well thought out idea, but I wonder if there is a way to work around this by passing something clever to Gitleaks using --log-opts.

@finnlander
Copy link

Additional context I suppose that the problem commit is : 7ff24de#diff-a99fcd6a981aa3d1d5a58aced014f97230d5e2f948e99cdc3f068330e3cca579

I think the changed line 72 is the culprit here:

  • previously there was "else if"-condition (i.e. if --no-git was not in the custom parameters, but is in the cmd, added by ML)
  • now there is simply "if"-condition, separated from the custom parameters check (if --no-git is included by any reason -> ignore it)

I've been "struggling" with the same issue here as in my case:

  • Gitleaks execution for the entire repository takes about 600 seconds (i.e. way too long for reasonable fast feedback loops)
  • It seems that REPOSITORY_GITLEAKS_PR_COMMITS_SCAN is not working when using push event trigger in GitHub (the code assumes use of pull-request trigger and of course the parameter name suggest it too) -> I want to trigger the MegaLinter a bit quicker/earlier, hence using push events.
  • And using --no-git does not work currently as the value is omitted.

Any ideas on how to work around the issue or a bugfix release would be much appreciated 😄 .

@nvuillam
Copy link
Member

nvuillam commented Nov 2, 2023

@DariuszPorowski will you find the time to solve the issue, or is it faster if someone else investigates it ? :)

@DariuszPorowski
Copy link
Contributor

@nvuillam unfortunately in the upcoming period I cannot handle this due to personal/work stuff. Probably closer to the EOY I can jump back to some open-source contribution.

@VictorRos
Copy link
Contributor

Hi!
I took time to contribute on MegaLinter to try fixing the problem.
PR is opened.
Wait and see!

nvuillam pushed a commit that referenced this issue Nov 14, 2023
* Fixed Gitleaks --no-git doesn't work anymore (#2945)

* Regression on the `--no-git` option which was systematically deleted.

  This prevents Gitleaks from treating git repository as a regular directory and scan those files.

* Update CHANGELOG.md
@nvuillam
Copy link
Member

Fixed :)

@VictorRos If you can confirm with beta version, it's nice ^^

@snaquekiller
Copy link
Author

that seem work on one of my repository i test . If other people can confirm that ok :)

@nvuillam
Copy link
Member

@snaquekiller thanks for your feedback :)

@VictorRos
Copy link
Contributor

@nvuillam I confirmed, @snaquekiller tested it for me 😄

We had a use case this morning where a developer had a problem with MegaLinter 7.2.1 and we didn't get the problem with MegaLinter beta.

We are waiting for next release to upgrade to next version all our repositories.

@nvuillam
Copy link
Member

@VictorRos thanks for the feedback :)

The next release should happen this week-end :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants