Skip to content
How it works

Scanner deep dive

How TruffleHog works

For vendor-neutral guidance, start with the Atlas exposure response workflow; frameworks and control alignment are on Standards & controls. Below, TruffleHog’s product lifecycle is labelled with the Atlas stage each step belongs to, and the engine pipeline follows the code at the catalog revision.

What TruffleHog does

TruffleHog finds secrets in places such as git history, cloud storage and CI systems, and classifies each one by the service it belongs to, using 903 detectors from 866 providers. For each secret it finds, it can verify whether the secret still works by asking that service. For 45 key types, a separate analyze command reports what a working key is allowed to do.

Verified against commit 2325546, the same TruffleHog version as the rest of Atlas. Each claim carries one of four tags. Open a tag to see its evidence.

From source
Read from TruffleHog's repository at the pinned commit. Shown as a small code icon after the sentence; it opens the exact lines.
Inferred
A conclusion the code supports but does not state. The reason and the code it rests on are listed.
From docs
TruffleHog Enterprise is not in the open-source code. Quoted from Truffle Security's docs, with the date it was read.
From the owner
Stated by the site owner from first-hand knowledge, with the date. Not in public code or docs.

TruffleHog product lifecycle

Follow a fictional service credential from a repository scan to an incident response. The example uses mock findings and makes no requests. Analysis and delivery depend on the setup, and remediation includes work the response team owns.

Explore the tasks that surround a scan. Available capabilities depend on the edition, source and credential.

Connect · Atlas stage: Discover

Explore supported sources and access methods. Source coverage depends on deployment and edition.

The scope determines where the scanner can look. An inaccessible repository creates a gap in coverage.

Example. An operator chooses the repository and history to inspect. The scan starts with the files and commits it can read.

Inputs, outputs and operational details
Input
Source location, scan scope and the access required by that source.
Output
Readable source data and its location.
Implementation and configuration
Select the connector and runner, then check the permitted repositories and refs with a read-only account where supported.
Security and operational limits
An expired grant, excluded ref or unreachable source can leave artifacts unscanned. Review access before treating a quiet run as evidence.

Edition and scope. Use a source command in the open-source CLI. Enterprise scanner placement and source configuration are documented separately.

  • The open-source CLI has 18 scan commands, mostly one per kind of source, such as git, GitHub, S3 and Docker.
  • When a source finds a file, it can hand it to a file handler. The handler detects the file type and opens archives and packages so their contents are scanned too.
Explore connect →

The scanning engine pipeline

Follow the stages in the pinned TruffleHog engine. Select a stage to read the source-backed details.

The lifecycle’s Connect stage supplies the engine’s Source stage. Detect spans chunking, decoding, keyword prefiltering and detector matching. Verify is conditional inside detection. Filtering and output hand findings to the surrounding workflow. The diagram describes the pinned open-source engine, with links to the evidence for each stage. Analyze, Notify and Remediate sit outside these eight stages.

  1. Stage 1: Source

    A source reads data from where it lives.
  2. Stage 2: Chunks

    Data is cut into chunks before scanning.
  3. Stage 3: Decode

    Encoded text is decoded so hidden secrets become readable.
  4. Stage 4: Keyword prefilter

    One fast search finds every detector keyword at once.
  5. Stage 5: Detect

    The detector applies its own patterns to each span.
  6. Stage 6: Verify

    If allowed, the detector asks the provider whether the secret works.
  7. Stage 7: Filter and dedupe

    Results are filtered by status and noise rules, then deduplicated.
  8. Stage 8: Output

    What is left is printed.
  1. Stage 1: Source

    A source reads data from where it lives.

    • The open-source CLI has 18 scan commands, mostly one per kind of source, such as git, GitHub, S3 and Docker.
    • When a source finds a file, it can hand it to a file handler. The handler detects the file type and opens archives and packages so their contents are scanned too.
  2. Stage 2: Chunks

    Data is cut into chunks before scanning.

    • A chunk is 10 KB by default. When a source passes the file size, as the Docker source does, the chunk size runs from 4 KB to 64 KB.
    • Each chunk also reads 3 KB past its end.
    • So a secret that crosses a chunk boundary by less than 3 KB is still seen whole, for sources that use this chunker, such as filesystem.
  3. Stage 3: Iterative decode

    Encoded text is decoded so hidden secrets become readable.

    • Every chunk goes through 5 decoders, in this order: UTF8, Base64, UTF16, EscapedUnicode, HTML.
    • Decoded output is fed back through the decoders, up to 5 passes by default (--max-decode-depth).
    • The output of every pass is scanned, not only the last one. Plain UTF8 is only read on the first pass.
  4. Stage 4: Keyword prefilter (Aho-Corasick)

    One fast search finds every detector keyword at once.

    • All detector keywords are loaded into one Aho-Corasick trie, and every decoded chunk is searched for all of them in a single pass, ignoring case.
    • Any one of a detector's keywords is enough to send the chunk to that detector.
    • A chunk with no keyword hit is dropped and never reaches a detector.
    • The detector gets only the matched spans: up to 512 bytes on each side of each keyword hit by default, or 1024 bytes on each side for detectors that pair two parts, such as an ID and a secret. Some detectors set their own sizes.
  5. Stage 5: Detect (FromData)

    The detector applies its own patterns to each span.

    • Each detector's FromData method applies its regular expressions to the span to find the exact secret.
    • Each call gets a time limit of 10 seconds by default, and --detector-timeout changes it.
  6. Stage 6: Verify

    If allowed, the detector asks the provider whether the secret works.

    • Verification happens inside the same FromData method, which receives a verify flag. With the verification cache on, the engine first calls it without verifying, to check the cache.
    • The call goes through a verification cache, so a credential seen again in the same scan is usually not checked again.
  7. Stage 7: Filter and dedupe

    Results are filtered by status and noise rules, then deduplicated.

    • Results on a line tagged trufflehog:ignore are dropped (for sources that track line numbers), and so are likely false positives and statuses you did not ask for.
    • Repeats of the same result at the same location are dropped, using a cache of the 5000 most recent results by default.
  8. Stage 8: Output

    What is left is printed.

    • The default output is plain text. JSON, GitHub Actions and SARIF formats are flags.

One interface for every detector

Every detector implements the same interface: FromData, Keywords, Type, Description.

How many detectors

  • The default detector list has 903 entries from 866 providers. A provider with versioned detectors, such as v1 and v2, counts once.
  • 43 of those entries sit behind a feature flag. The open-source CLI turns all of them on. Another 26 detectors appear only in commented-out lines.
  • The README says "over 800" secret types. These counts come from the code.
  • These counts describe open source at the pinned commit. Enterprise uses the same detectors but may be behind.

Browse detectors

Verification

Finding a string that looks like a key is not enough. TruffleHog can ask the provider whether the key works, and reports one of three statuses.

The README calls verification critical "to know if there’s an active present danger or not".

  • Verified

    The provider confirmed the secret works.

  • Unknown

    Verification was attempted or skipped and recorded an error, so the answer is not known.

  • Unverified

    Found, but not confirmed and with no verification error.

The notifier decides the status from two fields on each result: if Verified is set, it is verified. Otherwise, a verification error makes it unknown, and no error makes it unverified.

Decision rules, verification flags and noise controls

Analyze: beyond “is it live”

Verification answers whether a key works. Analyze asks what the key can do.

  • Analyze is its own command, trufflehog analyze: "Analyze API keys for fine-grained permissions information."
  • It supports 45 key types, from 44 analyzer folders. Airtable has two: one for OAuth tokens and one for personal access tokens.
  • Each analyzer implements Type and Analyze.
  • A normal scan does not run analyzers. You run analyze yourself on a key you already have.
  • The README says Analysis covers "the 20 some" most leaked credential types. The code supports 45.

See every analyzer

Implementation checklist

  1. Choose where the scanner runs. Review installation and runner prerequisites in the open-source deployment guide or the Enterprise deployment guide.
  2. Set the scan boundary and confirm source access. Use the Stack planner and the source setup pages to check which credentials and permissions the deployment requires. Confirm connectivity from the scanner to the source and, where needed, the verification provider.
  3. Choose the CLI command and review its flags and defaults. Use the verification decision rules to decide which outcomes you want to report.
    • --fail makes TruffleHog exit with code 183 when it prints any result. That means any status that passed --results, not only verified ones. The README says "if valid credentials are found".
    • The README's CI example scans only the new commits, with --since-commit and --branch, and uses --results=verified,unknown with --fail.
  4. For a CI integration, review the existing CI examples. For finding delivery, check notification integrations and confirm who handles the findings and which permissions the destination needs.

Deploying TruffleHog open source

Every way to run the free trufflehog CLI now has its own page, with a comparison table and the exact commands.

Deploying Enterprise

TruffleHog Enterprise is built from its own repository, which pulls in the open-source code. Its Enterprise-only parts are not in the open-source repository, so they cannot be read from source here. Claims below come from the owner, the Enterprise docs, or are inferred.

Deployment steps, sizing and commands for Enterprise now have their own page: a hosted scanner, or a self-hosted scanner on Kubernetes, Linux or Docker, with its configuration and sizing.

See every way to deploy TruffleHog Enterprise

Hosted or self-hosted scanners

  • TruffleHog Enterprise runs scanners in one of two ways. A hosted scanner runs in Truffle Security's infrastructure, isolated for your tenant.
  • A self-hosted scanner runs on hardware you operate and is configured with a local file.
  • Self-hosted scanners run on Kubernetes, a Linux host or Docker.
  • Kubernetes is the recommended option, installed with a Helm chart.

Engine

Enterprise uses the same detectors as open source, pulled in from the open-source code. New or changed detectors reach Enterprise some time after they land in open source.

Sources beyond the open-source CLI

The open-source code declares 27 more source types (not counting a test value) that no open-source source package uses. These are likely Enterprise sources.

Named in the README’s Enterprise section

5 of them are also named in the README's Enterprise section, the strongest sign they are Enterprise sources.

  • Confluence SOURCE_TYPE_CONFLUENCE
  • Jira SOURCE_TYPE_JIRA
  • Slack SOURCE_TYPE_SLACK
  • Microsoft Teams SOURCE_TYPE_TEAMS
  • SharePoint SOURCE_TYPE_SHAREPOINT
Also declared in the code, purpose unclear (22)
  • Azure Storage SOURCE_TYPE_AZURE_STORAGE
  • Bitbucket SOURCE_TYPE_BITBUCKET
  • Amazon ECR SOURCE_TYPE_ECR
  • Public Git SOURCE_TYPE_PUBLIC_GIT
  • npm packages (unauthenticated) SOURCE_TYPE_NPM_UNAUTHD_PACKAGES
  • PyPI packages (unauthenticated) SOURCE_TYPE_PYPI_UNAUTHD_PACKAGES
  • S3 (unauthenticated) SOURCE_TYPE_S3_UNAUTHED
  • GitHub org (unauthenticated) SOURCE_TYPE_GITHUB_UNAUTHENTICATED_ORG
  • Buildkite SOURCE_TYPE_BUILDKITE
  • Gerrit SOURCE_TYPE_GERRIT
  • JFrog Artifactory SOURCE_TYPE_JFROG_ARTIFACTORY
  • Public Event Monitoring SOURCE_TYPE_PUBLIC_EVENT_MONITORING
  • Slack Realtime SOURCE_TYPE_SLACK_REALTIME
  • Google Drive SOURCE_TYPE_GOOGLE_DRIVE
  • GCS (unauthenticated) SOURCE_TYPE_GCS_UNAUTHED
  • Azure Repos SOURCE_TYPE_AZURE_REPOS
  • Webhook SOURCE_TYPE_WEBHOOK
  • Sentry SOURCE_TYPE_SENTRY
  • GitHub Realtime SOURCE_TYPE_GITHUB_REALTIME
  • Slack Continuous SOURCE_TYPE_SLACK_CONTINUOUS
  • AWS Secrets Manager SOURCE_TYPE_AWS_SECRETS_MANAGER
  • Generic SOURCE_TYPE_GENERIC

Operational checks

  • Before trusting a quiet scan, check source access and scope. Confirm the scanner can read a representative artifact you expected it to cover.
  • Keep unknown results in triage. Check provider connectivity and the verification and filtering settings before interpreting missing or inconclusive results.
  • Test that a synthetic finding reaches the intended recipient and record who owns the response. Keep raw credential material out of notification and ticket copies.

Provenance and governance

The pipeline and detector behavior extracts are checked against the catalog revision. Extractor thogparse-tree-v3, source revision 23255461ddf3958c4d949d89925b03eaf263d838.

The pin applies to open-source code. Use the evidence tags to see which statements are inferred, which come from Enterprise documentation, and which come from the site owner. Check the cited scope and limitations before reusing a claim, and recheck it when the relevant source changes. Keep owner acceptance and observed test results distinct from source support.

Atlas reads Go syntax at the pinned checkout and writes pipeline facts and detector behavior as separate extracts. Each extracted fact carries its source location. The page model gives those facts readable labels and records interpretations with their basis. The loader rejects revision and extractor-version mismatches.

When the catalog refresh changes the pin, regenerate both extracts through the existing refresh workflow. Review missing facts, changed source spans and edition claims, then run the extractor fixtures, page-model tests and browser tests before accepting the refreshed snapshot. Follow the maintenance and regression guide.

Atlas reads TruffleHog’s code and describes it. It never runs a detector, tests a secret or calls a provider. About the atlas