trufflehog icon indicating copy to clipboard operation
trufflehog copied to clipboard

Should exit with a non-zero code on "error scanning repository"

Open vasylherman opened this issue 2 years ago • 0 comments

Please review the Community Note before submitting

Description

I configured a GitLab scanning task using TruffleHog. Within GitLab, there's a CI/CD Settings parameter called "Git shallow clone" When this parameter is set to 20, the "trufflehog git" command triggers an error scanning repository, yet it does not result in a non-zero exit code, which appears to be somewhat unusual.

Preferred Solution

Trufflehog should exit with a non-zero code on "error scanning repository"

Additional Context

To reproduce, just run: docker run -it trufflesecurity/trufflehog:3.59.0 git file://. && echo $?

logs:

🐷🔑🐷  TruffleHog. Unearth your secrets. 🐷🔑🐷

2023-10-09T12:04:58Z    info-0  trufflehog      error scanning repository       {"job_id": 1, "source_manager_worker_id": "j0EEy", "source_type": "SOURCE_TYPE_GIT", "source_name": "trufflehog - git", "repo": ".", "error": "repository does not exist"}
2023-10-09T12:04:58Z    info-0  trufflehog      finished scanning       {"chunks": 0, "bytes": 0, "verified_secrets": 0, "unverified_secrets": 0, "scan_duration": "106.74575ms"}
echo $?
0

References

No

vasylherman avatar Oct 09 '23 12:10 vasylherman