Gitleaks returns exit code 0 when a sequence of invalid flags is passed
Author: fdz-tiago-taveiraCreated Aug 12, 2024Updated Aug 27, 2026
Labelsbug
Describe the bug Gitleaks returns exit code 0 when the order of the flags should have caused it to fail (and return exit code 1).
To Reproduce Steps to reproduce the behavior:
touch config.tomlgitleaks detect -s --no-banner . -c config.tomlecho $?(0 is returned, despite the output showing the error)
Expected behavior Return exit code 1 (leaks or error encountered).
Screenshots n/a
Basic Info (please complete the following information):
- OS: macOS 14.5 (23F79)
- Gitleaks Version: 8.18.4
Additional context
Not passing the config file flag (i.e., gitleaks detect -s --no-banner .) returns the expected exit code (1).
I ran into this by chance due to having misplaced the arguments, other flag combinations possibly have the same behavior.
cc @zricethezav
Source: gitleaks/gitleaks