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

--first-parent command not working #163

Open
adtyarai opened this issue Aug 30, 2024 · 2 comments
Open

--first-parent command not working #163

adtyarai opened this issue Aug 30, 2024 · 2 comments

Comments

@adtyarai
Copy link

When the gitleaks-action workflow is executed through github workflows then internally it executes the command
/tmp/gitleaks-8.16.1/gitleaks detect --redact -v --exit-code=2 --report-format=sarif --report-path=results.sarif --log-level=debug --log-opts=--no-merges --first-parent e73a44d998131a96a95fd00b6be333ad5bb3dc09^..3d6334b5a261445b324da6cc29f5e35f81efb269
image
But when I'm executing this command directly I'm getting this error:
gitleaks detect --redact -v --exit-code=2 --log-level=debug --log-opts=--no-merges --first-parent 'e73a44d998131a96a95fd00b6be333ad5bb3dc09^..20849092156b04953da6648b9f07bd7d53ab13d7'
Error: unknown flag: --first-parent
Usage:
gitleaks detect [flags]

I need to understand why this --first-parent flag is not available for me or is their a workaround which I can try?
I've downloaded the same gitleaks version.

@pzarfos
Copy link

pzarfos commented Sep 2, 2024

Can you try making another commit and pushing it?

I had the same error when adding gitleaks to a new repo. It failed the first time, but after another commit and a push, gitleaks scanned just fine.

The issue seems to be in this section of code, where it is comparing baseRef and headRef:

If baseRef and headRef are not equal it uses that revision syntax of hash^..hash
...and I think the ^ syntax is causing the error.

To be honest, I'm not sure if this is an issue with the code, or if we did not set our HEAD properly in Github.

Can one of the maintainers weigh in on this one?

@adtyarai
Copy link
Author

adtyarai commented Sep 9, 2024

Hi @pzarfos
I tried this but still it is unable to recognise --first-parent flag.

Can someone from the gitleaks contributer check this?

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