Skip to main content

git-secret-scanner

This tool aims to find secrets and credentials in git repositories owned by Organizations or Groups using the libraries TruffleHog & Gitleaks.

Warning

This tool is only designed for Linux and MacOS. The current version only supports GitLab and GitHub.

Why this tool?

Trufflehog and Gitleaks are already designed to find secrets in git repositories. So you may wonder "what is the purpose of a tool combining both scanners?"

These two tools have both their own strenghts and weaknesses:

  • TruffleHog is very effective at classifying different secrets, but cannot find them all. It relies on detectors that can easily detect specific types of secrets, but not general secrets or general API keys.
  • Gitleaks is able to find many more secrets, but is not as good as Trufflehog at classification. It contains fewer detectors and relies on string entropy to detect potential secrets that are not found by its detectors.

We designed this tool to combine the strenghts of both previous tools in order to find as many secrets as possible and to have an efficient classification of these secrets.

Requirements

git-secret-scanner requires the following tools to work:

You can easily check that all requirements are met with the commands below:

$ python --version
$ pip --version
$ git --version
$ trufflehog --version
$ gitleaks version

Installation

Using pip

The simplest way to install git-secret-scanner is with pip.

$ pip install git-secret-scanner

Then export your personal access token for (GitHub or GitLab):

# GitHub
$ export GITHUB_TOKEN="<token>"
# GitLab
$ export GITLAB_TOKEN="<token>"

From source

  1. Clone the repository
$ git clone https://github.com/padok-team/git-secret-scanner.git # using https
# or
$ git clone git@github.com:padok-team/git-secret-scanner.git # using ssh
$ cd git-secret-scanner
  1. Install the Python requirements to run the tool
$ pip install -r requirements.txt
  1. Add your personal access token (GitHub / GitLab) for your git SaaS in your environment variables:
# GitHub
$ export GITHUB_TOKEN="<token>"
# GitLab
$ export GITLAB_TOKEN="<token>"

GitHub tokens require the repo scope, GitLab tokens require both read_api and read_repository scopes.

Usage

To get detailed usage information about how to use this tool, run

$ git-secret-scanner --help

Examples

GitHub

Scan the repositories of the organization my-org and write the output in the file output.csv:

$ git-secret-scanner github -o <my-org>

GitLab

Scan the repositories of the group my-group and write the output in the file output.csv:

$ git-secret-scanner gitlab -o <my-org>

Questions?

Open an issue to contact us or to give us suggestions. We are open to collaboration!

License

License

Metadata

Release files for git-secret-scanner 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for git-secret-scanner 0.4.0
File Size Uploaded
git_secret_scanner-0.4.0.tar.gz 33.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for git-secret-scanner 0.4.0
File Interpreter ABI Platform
git_secret_scanner-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 72.1 kB

Release files / git_secret_scanner-0.4.0.tar.gz

Download URL git_secret_scanner-0.4.0.tar.gz
Size 33.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c6453ce20e9866de1745601e657f5428550daaa9cf51af13fb9883311d7b3090
BLAKE2b-256 checksum
How to use checksums
39bce410bb520f0555947e597621c31500a3dc9d9a649d1a6b01cdeee0007f1f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / git_secret_scanner-0.4.0-py3-none-any.whl

Download URL git_secret_scanner-0.4.0-py3-none-any.whl
Size 38.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0bcacc5c9e44111b0c9b7bdd8bf77beb98d9a9ebead7e305c18bf3ad6e083f80
BLAKE2b-256 checksum
How to use checksums
84208ba48e3e4476238300713167300cc255a4f8c43ab5f1a57e8332b181d8b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.5

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page