Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

tartufo logo

Join Slack ci Codecov PyPI PyPI - Status PyPI - Python Version PyPI - Downloads Documentation Status License

tartufo searches through git repositories for secrets, digging deep into commit history and branches. This is effective at finding secrets accidentally committed. tartufo also can be used by git pre-commit scripts to screen changes for secrets before they are committed to the repository.

This tool will go through the entire commit history of each branch, and check each diff from each commit, and check for secrets. This is both by regex and by entropy. For entropy checks, tartufo will evaluate the shannon entropy for both the base64 char set and hexidecimal char set for every blob of text greater than 20 characters comprised of those character sets in each diff. If at any point a high entropy string > 20 characters is detected, it will print to the screen.

Example

Example Issue

Documentation

Our main documentation site is hosted by Read The Docs, at https://tartufo.readthedocs.io.

Usage

Usage: tartufo [OPTIONS] COMMAND [ARGS]...

  Find secrets hidden in the depths of git.

  Tartufo will, by default, scan the entire history of a git repository for
  any text which looks like a secret, password, credential, etc. It can also
  be made to work in pre-commit mode, for scanning blobs of text as a pre-
  commit hook.

Options:
  --rules FILENAME                Path(s) to regex rules json list file(s).
  --default-regexes / --no-default-regexes
                                  Whether to include the default regex list
                                  when configuring search patterns. Only
                                  applicable if --rules is also specified.
                                  [default: True]

  --entropy / --no-entropy        Enable entropy checks.  [default: True]
  --regex / --no-regex            Enable high signal regexes checks.
                                  [default: False]
  --scan-filenames / --no-scan-filenames            
                                  Check the names of files being scanned as well as their contents.
                                  [default: True]

  -ip, --include-path-patterns TEXT
                                  Specify a regular expression which matches
                                  Git object paths to include in the scan.
                                  This option can be specified multiple times
                                  to include multiple patterns. If not
                                  provided (default), all Git object paths are
                                  included unless otherwise excluded via the
                                  --exclude-path-patterns option.

  -xp, --exclude-path-patterns TEXT
                                  Specify a regular expression which matches
                                  Git object paths to exclude from the scan.
                                  This option can be specified multiple times
                                  to exclude multiple patterns. If not
                                  provided (default), no Git object paths are
                                  excluded unless effectively excluded via the
                                  --include-path-patterns option.

  -xe, --exclude-entropy-patterns TEXT
                                  Specify a regular expression which matches
                                  entropy strings to exclude from the scan.
                                  This option can be specified multiple times
                                  to exclude multiple patterns. If not
                                  provided (default), no entropy strings will
                                  be excluded ({path regex}::{pattern regex}).

  -e, --exclude-signatures TEXT   Specify signatures of matches that you
                                  explicitly want to exclude from the scan,
                                  and mark as okay. These signatures are
                                  generated during the scan process, and
                                  reported out with each individual match.
                                  This option can be specified multiple times,
                                  to exclude as many signatures as you would
                                  like.

  -od, --output-dir DIRECTORY     If specified, all issues will be written out
                                  as individual JSON files to a uniquely named
                                  directory under this one. This will help
                                  with keeping the results of individual runs
                                  of tartufo separated.

  -of, --output-format TEXT       Specify the format in which the output needs
                                  to be generated `--output-format json/compact/text`.
                                  Either `json`, `compact` or `text` can be specified.
                                  If not provided (default) the output will be generated
                                  in `text` format.

  --git-rules-repo TEXT           A file path, or git URL, pointing to a git
                                  repository containing regex rules to be used
                                  for scanning. By default, all .json files
                                  will be loaded from the root of that
                                  repository. --git-rules-files can be used to
                                  override this behavior and load specific
                                  files.

  --git-rules-files TEXT          Used in conjunction with --git-rules-repo,
                                  specify glob-style patterns for files from
                                  which to load the regex rules. Can be
                                  specified multiple times.

  --config FILE                   Read configuration from specified file.
                                  [default: tartufo.toml]

  -q, --quiet / --no-quiet        Quiet mode. No outputs are reported if the
                                  scan is successful and doesn't find any
                                  issues

  -v, --verbose                   Display more verbose output. Specifying this
                                  option multiple times will incrementally
                                  increase the amount of output.

  --log-timestamps / --no-log-timestamps
                                  Enable or disable timestamps in logging
                                  messages.  [default: True]

  -b64, --b64-entropy-score FLOAT
                                  Modify the base64 entropy score. If you
                                  specify a value greater than the default,
                                  tartufo lists higher entropy base64 strings
                                  (longer or more randomized strings). A lower
                                  value lists lower entropy base64 strings
                                  (shorter or less randomized strings).
                                  [default: 4.5]

  -hex, --hex-entropy-score FLOAT
                                  Modify the hexadecimal entropy score. If you
                                  specify a value greater than the default,
                                  tartufo lists higher entropy hexadecimal
                                  strings (longer or more randomized strings).
                                  A lower value lists lower entropy
                                  hexadecimal strings (shorter or less
                                  randomized strings).  [default: 3.0]

  -V, --version                   Show the version and exit.
  -h, --help                      Show this message and exit.

Commands:
  pre-commit        Scan staged changes in a pre-commit hook.
  scan-local-repo   Scan a repository already cloned to your local system.
  scan-remote-repo  Automatically clone and scan a remote git repository.

Contributing

All contributors and contributions are welcome! Please see our contributing docs for more information.

Attributions

This project was inspired by and built off of the work done by Dylan Ayrey on the truffleHog project.

Metadata

Release files for tartufo 3.0.0a1

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

Source distribution (sdist)

Source distribution for tartufo 3.0.0a1
File Size Uploaded
tartufo-3.0.0a1.tar.gz 42.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tartufo 3.0.0a1
File Interpreter ABI Platform
tartufo-3.0.0a1-py3-none-any.whl Python 3 none any Details

Total release size: 87.3 kB

Release files / tartufo-3.0.0a1.tar.gz

Download URL tartufo-3.0.0a1.tar.gz
Size 42.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a69474f76d00df9c80803f75a315efaa8affd4c015b35d2d250380403c77a01a
BLAKE2b-256 checksum
How to use checksums
8f2b06ab2eae035e9f8d864c9a821e6a02da79cfe13638a21a650ccd890c292a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.11 CPython/3.7.12 Linux/5.11.0-1020-azure

Release files / tartufo-3.0.0a1-py3-none-any.whl

Download URL tartufo-3.0.0a1-py3-none-any.whl
Size 44.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
250d120c624e37af44c342674aa9b4294f21b5f71a41e1054d9079a0b9dfddff
BLAKE2b-256 checksum
How to use checksums
de409633fb8c64c24edd848459b1503aaf239663e3c7ed872f66281bbb4cf8d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.11 CPython/3.7.12 Linux/5.11.0-1020-azure

Release history Release notifications | RSS feed

6.0.1

2 release files

5.0.2

2 release files

5.0.1

2 release files

5.0.0

2 release files

4.1.0

2 release files

4.0.1

2 release files

4.0.0

2 release files

3.3.1

2 release files

3.3.0

2 release files

3.2.1

2 release files

3.2.0

2 release files

3.1.4

2 release files

3.1.3

2 release files

3.1.2

2 release files

3.1.1

2 release files

3.1.0

2 release files

3.0.0

2 release files

This release

3.0.0a1 This release

2 release files

2.10.1

2 release files

2.9.0

2 release files

2.8.1

2 release files

2.8.0

2 release files

2.7.1

2 release files

2.7.0

2 release files

2.6.0

2 release files

2.5.0

2 release files

2.4.0

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.1

2 release files

2.1.0

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.2

2 release files

0.0.2

2 release files

0.0.1

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