|
|
há 7 anos atrás | |
|---|---|---|
| vendor | há 7 anos atrás | |
| .gitignore | há 7 anos atrás | |
| .travis.yml | há 7 anos atrás | |
| CHANGELOG.md | há 7 anos atrás | |
| CONTRIBUTING.md | há 7 anos atrás | |
| Dockerfile | há 7 anos atrás | |
| Gopkg.lock | há 7 anos atrás | |
| Gopkg.toml | há 7 anos atrás | |
| LICENSE.md | há 7 anos atrás | |
| Makefile | há 7 anos atrás | |
| README.md | há 7 anos atrás | |
| github.go | há 7 anos atrás | |
| gitlab.go | há 7 anos atrás | |
| gitleaks.toml | há 7 anos atrás | |
| gitleaks_test.go | há 7 anos atrás | |
| main.go | há 7 anos atrás |
Gitleaks provides a way for you to find unencrypted secrets and other unwanted data types in git source code repositories.
As part of it's core functionality, it provides;
It has been sucessfully used in a number of different scenarios, including;
Written in Go, gitleaks is available in binary form for many popular platforms and OS types from the releases page. Alternatively, executed via Docker or it can be installed using Go directly, as per the below;
# Run gitleaks against a public repository
docker run --rm --name=gitleaks zricethezav/gitleaks -v -r https://github.com/zricethezav/gitleaks.git
# Run gitleaks against a local repository already cloned into /tmp/
docker run --rm --name=gitleaks -v /tmp/:/code/ zricethezav/gitleaks -v --repo-path=/code/gitleaks
# Run gitleaks against a specific Github Pull request
docker run --rm --name=gitleaks -e GITHUB_TOKEN={your token} zricethezav/gitleaks --github-pr=https://github.com/owner/repo/pull/9000
go get -u github.com/zricethezav/gitleaks
gitleaks has a wide range of configuration options that can be adjusted at runtime or via a configuration file based on your specific requirements.
Usage:
gitleaks [OPTIONS]
Application Options:
-r, --repo= Repo url to audit
--github-user= Github user to audit
--github-org= Github organization to audit
--github-url= GitHub API Base URL, use for GitHub Enterprise. Example: https://github.example.com/api/v3/ (default: https://api.github.com/)
--github-pr= Github PR url to audit. This does not clone the repo. GITHUB_TOKEN must be set
--gitlab-user= GitLab user ID to audit
--gitlab-org= GitLab group ID to audit
-c, --commit= sha of commit to stop at
--depth= maximum commit depth
--repo-path= Path to repo
--owner-path= Path to owner directory (repos discovered)
--threads= Maximum number of threads gitleaks spawns
--disk Clones repo(s) to disk
--single-search= single regular expression to search for
--config= path to gitleaks config
--ssh-key= path to ssh key
--exclude-forks exclude forks for organization/user audits
-e, --entropy= Include entropy checks during audit. Entropy scale: 0.0(no entropy) - 8.0(max entropy)
-l, --log= log level
-v, --verbose Show verbose output from gitleaks audit
--report= path to write report file
--redact redact secrets from log messages and report
--version version number
--sample-config prints a sample config file
Help Options:
-h, --help Show this help message
Gitleaks provides consistent exist codes to assist in automation workflows such as CICD platforms and bulk scanning.
These can be effectively used in conjunction with the report output file to detect and return meaningful data back to the user or external system about if leaks have been detected, and where they reside.
The code return codes are:
0: no leaks
1: leaks present
2: error encountered
To audit public repositories for user on GitLab use --gitlab-user= and for group --gitlab-org=. For private repositories add GITLAB_TOKEN environment variable with your personal access token (is used to list all repositories via API) and set --ssh-key= to SSH key path (is used to clone repository).
If self hosted GitLab server add GITLAB_URL environment variable with your URL.
Auditing Bitbucket Server Data for Credentials in AWS (sourcedgroup.com)
This blog post details how gitleaks was used to audit data in Atlassian Bitbucket server when hosted on AWS and visualise the results in a compliance dashboard using Splunk.
How does gitleaks differ to Github token scanning?