Gitleaks - Searches Full Repo History For Secrets And Keys
Searches Full Repo History For Secrets And Keys.
Installing
go get -u github.com/zricethezav/gitleaks
Usage and Explanation
./gitleaks [options] <url/path>
Options
usage: gitleaks [options] <URL>/<path_to_repo>
Options:
-u --user Git user mode
-r --repo Git repo mode
-o --org Git organization mode
-l --local Local mode, gitleaks will look for local repo in <path>
-t --temp Clone to temporary directory
-v --verbose Verbose mode, will output leaks as gitleaks finds them
--report-path=<STR> Save report to path, gitleaks default behavior is to save report to pwd
--clone-path=<STR> Gitleaks will clone repos here, default pwd
--concurrency=<INT> Upper bound on concurrent diffs
--since=<STR> Commit to stop at
--b64Entropy=<INT> Base64 entropy cutoff (default is 70)
--hexEntropy=<INT> Hex entropy cutoff (default is 40)
-e --entropy Enable entropy
-h --help Display this message
--token=<STR> Github API token
--stopwords Enables stopwords
Exit Codes
code | explanation |
---|---|
0 | Gitleaks succeeded with no leaks |
1 | Gitleaks failed or wasn't attempted due to execution failure |
2 | Gitleaks succeeded and leaks were present during the audit |
Examples
gitleaks
.git
is presentgitleaks --local $HOME/audits/some/repo
HOME/audits/some/repo
if .git
is presentgitleaks https://github.com/some/repo
github.com/some/repo.git
and clone repo togitleaks --clone-path=$HOME/Desktop/audits https://github.com/some/repo
github.com/some/repo.git
and clone repo to $HOME/Desktop/auditsgitleaks --temp https://github.com/some/repo
github.com/some/repo.git
and clone repo to $TMPDIR (this will remove repos after audit is complete)gitleaks --temp -u https://github.com/some-user
some-user
's repos. Again, --temp
flag will clone all repos into $TMPDIR after be removed after auditIf you find a valid leak in a repo
Please read the Github article on removing sensitive data from a repository to remove the sensitive information from your history.
Run me with docker
Simply run
docker run --rm --name=gitleaks zricethezav/gitleaks https://github.com/zricethezav/gitleaks
Or build the image yourself to get the latest version :docker build -t gitleaks .
docker run --rm --name=gitleaks gitleaks https://github.com/zricethezav/gitleaks
Gitleaks - Searches Full Repo History For Secrets And Keys
Reviewed by Zion3R
on
5:13 PM
Rating: