Bez popisu

Zachary Rice d0f44da4c2 Merge pull request #151 from AdamKobi/add_support_for_tokens před 7 roky
vendor 79a8983bac support GitLab před 7 roky
.gitignore 79a8983bac support GitLab před 7 roky
.travis.yml 1f80d14f3f Gitleaks v1.0.0 (#75) před 7 roky
CHANGELOG.md 392d79b9e2 added changes to changelog před 7 roky
CONTRIBUTING.md 4b350987a1 Fix typos in contributing.md před 7 roky
Dockerfile 8a76e0af27 Update Go docker version před 7 roky
Gopkg.lock 79a8983bac support GitLab před 7 roky
Gopkg.toml 79a8983bac support GitLab před 7 roky
LICENSE.md d482577e47 copyleft před 7 roky
Makefile d387f528c4 update lint před 7 roky
README.md 573bf46fd1 grammar not my best subject před 7 roky
github.go f8e609d4bf added case for when using oauth token for both listing and cloning repos před 7 roky
gitlab.go 793bbc793f bumping version, format, changelog, uhhhhhh, test... a single test před 7 roky
gitleaks.toml b4c6fe92e0 fix slack token format před 7 roky
gitleaks_test.go cb6b01cc5d Merge pull request #149 from camaya/fix-files-whitelist-github-prs před 7 roky
main.go cb6b01cc5d Merge pull request #149 from camaya/fix-files-whitelist-github-prs před 7 roky

README.md

gitleaks

Travis

Audit git repos for secrets

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;

  • Github support including support for bulk organisation and repository owner (user) repository scans, as well as pull request scanning for use in common CI workflows.
  • Support for private repository scans, and repositories that require key based authentication
  • Output in CSV and JSON formats for consumption in other reporting tools and frameworks
  • Externalised configuration for environment specific customisation including regex rules
  • Customisable repository name, file type, commit ID, branchname and regex whitelisting to reduce false positives
  • High performance through the use of src-d's go-git framework

It has been sucessfully used in a number of different scenarios, including;

  • Adhoc scans of local and remote repositories by filesystem path or clone URL
  • Automated scans of github users and organisations (Both public and enterprise platforms)
  • As part of a CICD workflow to identify secrets before they make it deeper into your codebase
  • As part of a wider secrets auditing automation capability for git data in large environments

Example execution

Installation

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;

Docker
# 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
go get -u github.com/zricethezav/gitleaks

Usage and Options

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

Exit Codes

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

Additional information

Give Thanks

If using gitleaks has made you job easier consider donating to an organization, C-U at Home, that does vital work for those who most need it in the community of Champaign-Urbana, IL (my home).

From C-U at Home:

C-U at Home is a grassroots, 501 c (3), faith-based homelessness ministry with facilities located in the Champaign-Urbana area. Due to our not-for-profit status, all gifts made to C-U at Home (both monetary and in-kind) are tax deductible. Our ministry is funded 100% by the community and we have made it a priority not to accept any state or federal funds. We feel that through community dollars, we can stay true to our mission. While our mission statement reads, “C-U at Home engages and mobilizes our community to house and support the most vulnerable homeless on their journey of healing and restoration,” our connection with those we serve goes much deeper.

Donate: https://www.cuathome.us/give/