Join our Newsletter — 33% off our NHI Course
Home› Guides› Secret Scanner Rule Coverage Comparison Guide: Gitleaks, GitHub…
Guide Secrets Management

Secret Scanner Rule Coverage Comparison Guide: Gitleaks, GitHub and TruffleHog Compared

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, edited by Lalit Choda Updated 8 November 2026 12 min read
On this page

Secret scanners cover different credential types, so the safest approach is to test coverage against your own credential inventory before you rely on a tool. Gitleaks, GitHub secret scanning and TruffleHog are the three most widely used scanners, and they count coverage in different units and verify in different ways. This guide describes each on the evidence, using the published rule and pattern data as of 27 October 2026: how each counts and structures its rules, where coverage differs for common credential types, how push protection and validity checks change the picture, and how to combine and extend them so your own credential inventory is covered. It is for AppSec and platform teams choosing or tuning scanners. For evaluating commercial products see the Secrets Scanning Buyer's Guide.

Key takeaways

  • The headline numbers are not comparable. GitHub lists 531 patterns (token types), Gitleaks ships 222 rules, and TruffleHog has about 890 detector packages, most covering one provider; each unit means something different.
  • Test coverage per credential type. Each tool has its own rule set, so run sample tokens for the types you use, such as crates.io, Snowflake and Okta tokens, through every scanner you rely on.
  • Verification is the biggest functional difference. TruffleHog verifies most detectors against the live service; GitHub validity-checks 165 provider patterns on GitHub.com; Gitleaks verifies nothing and relies on precise patterns and entropy.
  • GitHub coverage depends on licence and visibility. 413 patterns are in the partner programme for public repositories; 118 are detected only in private repositories with Secret Protection.
  • Coverage should be measured against your inventory. List the credential types your organisation actually issues and uses, then test each scanner against samples of them.

How identity and access work across secret scanners

Each scanner represents "a kind of secret" differently, which shapes what it can find and how it reports it.

AspectGitleaksGitHub secret scanningTruffleHog
Unit of coverageRule: id, regex, keywords, optional entropy and allowlistsPattern: one token type of one provider (secretType)Detector: Go package per provider, often matching several token formats, with a verification routine
Count (27 Oct 2026)222 default rules531 patterns from 207 providersAbout 890 detector packages; the project states over 700 support active verification
Generic detectiongeneric-api-key with entropy 3.5Non-provider patterns (private keys, HTTP basic and bearer headers, connection strings) and AI-detected passwordsDetector-led, provider-specific matching
VerificationConfirm with the vendorValidity checks for 165 provider patterns on GitHub.comLive verification per detector; results labelled verified, unverified or unknown
Blocking at commitPre-commit hook and CI failurePush protection on 465 patternsCI failure with --fail
Where it scansGit history, directories, stdinGitHub repositories (and other GitHub content as enabled)Git, GitHub organisations, S3, GCS, Docker images and more
LicenceMITGitHub feature (Secret Protection for private repositories)AGPL-3.0

The counting difference is not a technicality. GitHub lists GitLab as 12 separate patterns, Gitleaks has 15 GitLab rules (one per token type, from deploy tokens to CI job tokens), and TruffleHog has 2 GitLab detectors. All three may still catch a GitLab personal access token. Compare coverage by credential type, not by totals.

Admin roles and privileged access

Coverage is only useful if the right people can act on findings and the wrong people cannot tamper with rules.

  • GitHub: repository owners, organisation owners, security managers, enterprise administrators and users with the admin role can define custom patterns. Only the pattern's creator can edit it or run a dry run. Treat alert dismissal and push protection bypass as privileged actions and review them.
  • Gitleaks: the configuration file is the control. Keep a central configuration that extends the default rules ([extend] useDefault = true), protect it with code owners, and review every allowlist change and gitleaks:allow comment.
  • TruffleHog: verification calls third-party APIs with found credentials. Run it under a controlled service identity, limit who can run organisation-wide verified scans, and log those runs.
  • Scanner tokens: organisation-wide scans need read access to every repository; that token is itself a high-value secret. See the GitHub Personal Access Tokens Security Guide.

Integrations, API tokens and service accounts

Coverage spot checks by credential type

The table compares coverage for credential types that matter to identity and NHI programmes. It counts entries whose name matches the provider in each tool's published data on 27 October 2026; "Confirm with the vendor" means no matching rule, pattern or detector was found in the published data, so check current coverage with the vendor.

Credential typeGitleaksGitHubTruffleHogPractical note
crates.io API tokenConfirm with the vendorcratesio_api_token, push protectionConfirm with the vendorRepositories outside GitHub need a custom rule for the cio prefix
NuGet API keynuget-config-password rule; confirm API key coverage with the vendornuget_api_key with validity check on GitHub.comDetector with verificationTest each scanner with a sample token and add a custom rule where needed
Doppler tokensdoppler-api-token for personal tokensSix token types with validity checksAll documented prefixes, verifiedInclude service tokens (dp.st.) in your coverage test
1Password service account tokenRule presentDetected in private repositories with Secret ProtectionConfirm with the vendorConfirm partner programme reporting with GitHub and 1Password
Infisical credentialsConfirm with the vendorConfirm with the vendorLegacy service token detectorRely on short TTLs and IP limits, not scanning
SnowflakeConfirm with the vendor3 patterns, including programmatic access tokensDetectorTest each scanner with a sample token and add a custom rule where needed
Okta API tokenokta-access-tokenConfirm with the vendorDetectorInclude Okta tokens in your coverage test
Generic JWTjwt and jwt-base64Vendor JWT patternsJWT detector with OIDC-based verificationInclude first-party JWTs in your coverage test
HashiCorp Vault tokensvault-service-token and vault-batch-tokenService, batch and root service token patterns for private repositoriesVault detectorsConfirm partner programme reporting with GitHub and HashiCorp
AI provider keys (Anthropic, OpenAI, Hugging Face)Rules for Anthropic API and admin keys, OpenAI and Hugging Face tokensAnthropic 5 patterns, OpenAI 1, Hugging Face 2, with validity checks on someDetectors with verificationNew AI key formats appear quickly; re-test after each scanner release
DatabricksOne API token rule12 patterns including OAuth secrets, refresh tokens and session tokensToken detectorInclude Databricks OAuth and session credentials in your coverage test
AWS access keysAccess key and Bedrock API key rules3 patterns with validity checksDetector, verifiedWell covered everywhere

The individual credential pages go deeper: see the RubyGems, NuGet and Crates.io Publishing Tokens Guide, the Akeyless, Doppler and 1Password Machine Access Guide and the JWT and Session Tokens in Code and Logs Guide.

Encoded and wrapped secrets

Secrets are often committed in a form the pattern does not expect: base64-encoded in Kubernetes manifests, embedded in a JWT, URL-encoded in a connection string or split across lines. Test these forms explicitly. In the GitHub pattern data, 21 of 531 patterns are marked as supporting base64-encoded detection; Gitleaks has a specific jwt-base64 rule and its other rules match the raw form. Include encoded samples in your coverage test, and where your manifests routinely encode secrets, decode them in a pre-processing step before scanning or use a tool that decodes automatically.

Metadata and context

Beyond detect or miss, tools differ in what they tell the triager. GitHub offers extended metadata (owner, issue and expiry dates) for 70 patterns as a preview feature, and token metadata for GitHub's own tokens. TruffleHog detectors can attach extra data to a result, for example the issuer, algorithm and expiry of a JWT. Gitleaks reports the rule, file, commit, author, entropy and a fingerprint. Rich metadata shortens the time from finding to owner, which is often the slowest step in remediation.

Partner programme and visibility

GitHub's partner programme matters most for public code: when a partner pattern appears in a public repository, GitHub notifies the provider, which can revoke the credential. Of the 531 patterns, 413 are partner patterns and 118 are detected only for private repositories with Secret Protection. GitHub Enterprise Server differs again: 30 of the patterns validity-checked on GitHub.com, including the NuGet API key, are not validity-checked on Enterprise Server, so self-hosted estates should confirm coverage against the documentation for their version. A credential type outside the partner programme can sit in a public repository with nobody told; the Toyota T-Connect Key Exposure 2022 involved an access key that stayed in a public GitHub repository for almost five years.

Logging and detection

Measuring coverage properly

  1. Build the inventory: list every credential type your organisation issues or consumes: cloud keys, CI and VCS tokens, SaaS API keys, secrets manager tokens, package registry tokens and internal service keys.
  2. Collect samples: for each type, obtain revoked or test credentials in the real format. Never use live secrets as test data.
  3. Run every scanner: scan a test repository containing the samples, in realistic contexts (config files, code, environment files, base64-encoded values).
  4. Record the matrix: detected or not, blocked at push or not, verifiable or not, per tool and type.
  5. Close gaps: write custom rules for missing types, preferring the tool where blocking happens earliest.
  6. Re-run on each scanner upgrade: rule sets change frequently; keep the test repository as a regression suite.

Metrics

  • Inventory coverage: share of your credential types detected by at least one scanner in your pipeline (target: 100 percent).
  • Block coverage: share detected before code reaches the shared repository (pre-commit or push protection).
  • Verification coverage: share of detected types that can be validity-checked.
  • Custom rule count and precision: number of custom rules and their confirmed true positive rate.
  • Duplicate findings: the same secret reported by multiple tools, which shows overlap and helps deduplicate triage.

Hardening baseline

Choosing and combining scanners

SituationPractical combinationWhy
All code on GitHub with Secret ProtectionGitHub push protection plus custom patterns; Gitleaks or TruffleHog for history and non-GitHub sourcesBlocking at push with validity checks, filled out by a second rule set
GitHub without Secret Protection on private repositoriesGitleaks pre-commit and CI; TruffleHog verified scans on a scheduleGitHub private repository patterns come with the Secret Protection licence
GitLab, Bitbucket or self-hosted GitGitleaks in CI plus TruffleHog for verificationScanners that run in your own CI cover these platforms
Containers, buckets and artifactsTruffleHog source scans for images and storageBuilt artifacts need a scanner that reads images and storage
Large incident or acquisitionTruffleHog --results=verified first, then broader triageLive credentials ranked first

Rollout

  1. Pick a primary blocking control: GitHub push protection or a Gitleaks pre-commit hook, depending on your platform and licence.
  2. Add a second engine in CI: run the other rule set in report mode for a month, compare findings, then decide which rules to enforce.
  3. Write custom rules for gaps: extend the Gitleaks default configuration or define GitHub custom patterns, using GitHub's dry run (a sample of up to 1,000 matches, across all repositories or up to 10 selected ones) before enabling push protection on them.
  4. Schedule verified scans: run TruffleHog verified scans across history and artifacts weekly, routing live findings to an incident queue.
  5. Deduplicate: feed all findings into one triage queue keyed on a hash of the secret, so the same key reported by three tools is one ticket.

Small teams can usually stop at one blocking control plus one scheduled verified scan. Large organisations benefit from a central rules repository, a coverage regression suite and per-rule precision tracking. See the Generic API Key Detection Guide for tuning.

Framework mapping

ControlNIST SP 800-53 Rev. 5NIST CSF 2.0OWASP and ATT&CK
Scanning code and artifacts for secretsRA-5, SI-4DE.CM-09, ID.RA-01OWASP NHI2 Secret Leakage; T1552.001 Credentials In Files
Blocking secrets at commit or pushSA-11, CM-3PR.PS-06OWASP CICD-SEC-6 Insufficient Credential Hygiene
Credential type inventoryCM-8ID.AM-02T1078 Valid Accounts
Revocation of verified findingsIA-5RS.MI-01T1552 Unsecured Credentials

Common misconfigurations

  • Choosing by total rule count: a bigger number does not mean your credential types are covered.
  • Assuming GitHub covers private repositories: secret scanning on private repositories, including the 118 non-partner patterns, depends on Secret Protection being enabled.
  • Running only verified results: --results=verified hides secrets the tool cannot verify, including many internal and HMAC secrets; use verified,unknown for coverage.
  • Overriding rather than extending defaults: a custom Gitleaks configuration without useDefault silently drops the built-in rules.
  • Never re-testing: upstream rule changes can remove or alter detection for a type you depend on.
  • Ignoring non-Git sources: images, buckets, wikis and CI logs hold the same secrets.

Practitioner checklist

  • List every credential type your organisation issues or consumes.
  • Build a test repository of revoked or test samples in realistic contexts.
  • Run Gitleaks, GitHub secret scanning and TruffleHog against it and record the coverage matrix.
  • Write custom rules or patterns for every gap and add them to the regression suite.
  • Enable blocking at commit or push for the highest-risk types.
  • Schedule verified scans across history and artifacts, keeping unknown results in scope.
  • Confirm Secret Protection coverage for private GitHub repositories.
  • Deduplicate findings from all tools into one triage queue.
  • Re-run the coverage test after every scanner upgrade.

Standards and references

Related NHI Mgmt Group resources: Secrets Scanning Buyer's Guide · Git Secret Scanning Guide · Generic API Key Detection Guide · OWASP NHI Top 10 NHI2 Secret Leakage Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 8 November 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security. nhimg.org

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick the PDF box to continue.