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 making Error with "Invalid revision range" #117

Open
tarunkant opened this issue Jun 6, 2023 · 2 comments
Open

GitLeaks making Error with "Invalid revision range" #117

tarunkant opened this issue Jun 6, 2023 · 2 comments

Comments

@tarunkant
Copy link

Hello,
I would like to report an issue where GitLeaks CI fails with the error Invalid revision range.

Reproduction steps:

  1. Create a PR with a commit to a target branch that runs GitLeaks on PRs
  2. Instantly, create a new commit on the source branch
  3. Notice the GitLeaks CI check fails on the 1st commit with similar to below details:
[...]
7:30AM DBG executing: /usr/bin/git -C . log -p -U0 --no-merges --first-parent a833a[...]^..ea4e0[...]
7:30AM ERR [git] fatal: Invalid revision range a833a[...]^..ea4e0[...][27](https://github.com/xxxxx#step:5:28)
7:30AM DBG 0 commits scanned. Note: this number might be smaller than expected due to commits with no additions
7:30AM ERR git error encountered, see logs
7:30AM WRN partial scan completed in 60.2ms
7:30AM WRN no leaks found in partial scan
[...]

This issue seems like a race-condition to me where the GitLeaks initiated on the 1st commit but also got the details of the latest commit but git log does not have the details about the latest commit.

Root Cause:
I also did some analysis:
1st commit: a833a --> Initiated the GitLeaks CI --> Fails with Invalid revision range error
2nd commit: ea4e0 (note that this commit should be instantly after the 1st commit so that GitLeaks gets confused) --> Initiated the GitLeaks CI --> Pass (obv if no leak found)

Now notice, GitLeaks on the 1st commit has the Invalid revision range error, and looking in detail you will find out that it also has the commit address of the 2nd commit. How is that possible?

cc/ @weineran @zricethezav

Thanks!

@lukasmrtvy
Copy link

Related #113 ?

@tarunkant
Copy link
Author

Yes, kind of similar to #113.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants