GithubHelp home page GithubHelp logo

lukehuang / gitleaks Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gitleaks/gitleaks

0.0 2.0 0.0 3.47 MB

Audit git repos for secrets ๐Ÿ”‘

License: GNU General Public License v3.0

Dockerfile 0.86% Makefile 1.81% Go 97.32%

gitleaks's Introduction

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
  -p, --private        Include private repos in audit
  -b, --branch=        branch name to audit (defaults to HEAD)
  -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)
      --max-go=        Maximum number of concurrent go-routines gitleaks spawns
      --disk           Clones repo(s) to disk
      --all-refs       run audit on all refs
      --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 consisten 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

gitleaks's People

Contributors

apostov avatar arjunyel avatar bestform avatar devnixs avatar equinox avatar eripa avatar helixspiral avatar keirans avatar loicbourgois avatar pbnj avatar plutov avatar realzcong avatar ryan-copperleaf avatar zricethezav avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.