# GitHub Secret Scanning, Dependabot, TruffleHog and Gitleaks

Protect GitHub repositories from leaked secrets and vulnerable dependencies with secret scanning, push protection, Dependabot, TruffleHog and Gitleaks.

Author: Steven Phan
Published: 2026-11-12
Article: https://stevenphan.ca/blog/github-secret-scanning-dependabot-trufflehog-gitleaks/

To protect GitHub repositories from leaked secrets and vulnerable dependencies, you need two different kinds of checks. One kind looks for credentials such as API keys and tokens in your code and history. The other looks for known-vulnerable packages. GitHub secret scanning and push protection handle the first job, Dependabot handles the second, and open-source scanners like TruffleHog and Gitleaks can fill gaps. If a key has already leaked, jump to our companion guide on [what to do if an API key leaked in a GitHub repo](https://stevenphan.ca/blog/what-to-do-if-api-key-leaked-in-github-repo/).

This is general guidance, not legal or compliance advice. Run scanners only on repositories you own or are authorized to scan, and tell your security team before you run any new scanning tool in a work environment. Prices and plan details below were checked on 2026-11-12, and GitHub changes its pricing and features, so confirm the current numbers on the [GitHub security plans page](https://github.com/security/plans). Commands and config files marked "not run here" are composed from the documentation and weren't executed while writing this post.

## Quick answer

Work through the layers in this order and stop adding layers when your situation is covered.

1. Turn on GitHub's own secret scanning and push protection. They're free on public repositories. For private repositories, GitHub's docs describe them as part of the paid Secret Protection product.
2. Turn on Dependabot. It's free on all plans, but it finds vulnerable dependencies, not secrets, so it never replaces secret scanning.
3. Add TruffleHog if you want credential checking, and decide up front about verification. It appears to verify by default, which means live calls to the provider with each credential it finds. Those calls can look like suspicious activity to a managed security monitoring service or your security team. Use `--no-verification` or warn them first.
4. Add Gitleaks as a free scanner with no live verification, keeping in mind that its maintainer describes it as feature complete.

<nav class="toc" aria-label="Table of contents">
<p><strong>On this page</strong></p>
<ol>
<li><a href="#what-each-tool-finds-and-what-it-misses">What each tool finds and what it misses</a></li>
<li><a href="#github-native-features-and-what-they-cost">GitHub native features and what they cost</a></li>
<li><a href="#turn-on-secret-scanning-and-push-protection">Turn on secret scanning and push protection</a></li>
<li><a href="#set-up-dependabot">Set up Dependabot</a></li>
<li><a href="#trufflehog-and-the-verification-warning">TruffleHog and the verification warning</a></li>
<li><a href="#gitleaks-as-a-free-scanner">Gitleaks as a free scanner</a></li>
<li><a href="#comparison-table">Comparison table</a></li>
<li><a href="#layered-setups-for-three-situations">Layered setups for three situations</a></li>
<li><a href="#what-to-do-when-a-scanner-finds-a-secret">What to do when a scanner finds a secret</a></li>
<li><a href="#faq">FAQ</a></li>
<li><a href="#where-to-go-next">Where to go next</a></li>
</ol>
</nav>

![Original diagram of layered defence. Lane 1, secrets: push protection stops a secret before the commit lands, secret scanning finds what is already in the repository, and TruffleHog and Gitleaks are free scanners, with a warning that TruffleHog verification calls provider APIs so warn your security team first or use --no-verification. Lane 2, a separate job: Dependabot finds vulnerable dependencies, not secrets.](https://stevenphan.ca/_astro/secret-scanning-layers-flow.BxccjPwu_Z1LY3gc.webp)

[Watch the demonstration video](https://stevenphan.ca/media/github-secret-scanning-dependabot-trufflehog-gitleaks.mp4)

This silent, captioned video of about one minute shows what each tool finds, why Dependabot is not a secret scanner, and why TruffleHog verification needs a warning to your security team or the --no-verification flag.

## What each tool finds and what it misses

Two problems get lumped together, and mixing them up leaves a hole.

A leaked secret is a credential sitting in a repository, such as an API key or token, that anyone with read access to the code and git history can use. A vulnerable dependency is a package your project uses that has a published security advisory.

Dependabot lives entirely in the second group. It offers alerts for vulnerable dependencies, security updates that open pull requests with fixes, and version updates that keep dependencies current even when nothing is vulnerable. It doesn't look for hardcoded secrets at all. Secret scanning, push protection, TruffleHog and Gitleaks sit in the first group and say nothing about vulnerable packages.

## GitHub native features and what they cost

GitHub unbundled its old Advanced Security product into two paid products: GitHub Secret Protection and GitHub Code Security. As of 2026-11-12, the [GitHub security plans page](https://github.com/security/plans) lists Secret Protection at $19 USD and Code Security at $30 USD, each per active committer per month. An active committer, per [GitHub's billing docs](https://docs.github.com/en/billing/concepts/product-billing/github-advanced-security), is someone who pushed a commit to the repository in the last 90 days, counted once across an organization or enterprise. AI-based features draw on separate "AI Credits." GitHub changes pricing and plan details, so treat these numbers as a snapshot.

What you get depends on whether the repository is public or private.

- **Public repositories, all plans:** secret scanning alerts, push protection, provider patterns, code scanning and dependency review are free, per GitHub's [security features overview](https://docs.github.com/en/code-security/getting-started/github-security-features). The secret scanning docs say it "runs automatically for free" on public repositories.
- **Private and internal repositories:** the docs say you need to pay to use these features. Secret scanning and push protection need Secret Protection on a GitHub Team or GitHub Enterprise Cloud plan. The docs describe user-owned private repositories as covered only with Enterprise Managed Users (or GitHub Enterprise Server), and the page doesn't spell out the Free plan separately, so check it for your exact plan.
- **Free on all plans:** the dependency graph, SBOM export, the GitHub Advisory Database, Dependabot alerts, Dependabot security updates and Dependabot version updates.

User-level push protection is on by default for individual accounts on github.com and blocks pushes of secrets to public repositories, but repository-level push protection is disabled by default, per the [push protection docs](https://docs.github.com/en/code-security/secret-scanning/introduction/about-push-protection). And GitHub offers a free, on-demand [secret risk assessment](https://docs.github.com/en/code-security/how-tos/secure-at-scale/configure-organization-security/configure-specific-tools/assess-your-secret-risk) for organizations on GitHub Team and GitHub Enterprise. Org owners and security managers can run it once every 90 days.

GitHub also offers [validity checks](https://docs.github.com/en/code-security/concepts/secret-security/about-validity-checks), a setting that tests whether a detected secret is still active by calling the issuer's API. It's GitHub's version of the verification idea we'll meet in TruffleHog.

## Turn on secret scanning and push protection

The menu paths below were last checked on 2026-11-12. The settings moved recently. The repository "Security" tab is now called "Security and quality," and the old "Code security and analysis" settings page is now "Advanced Security" under "Security and quality." Older blog posts and videos show the old paths, so don't be alarmed when they don't match.

### In one repository

Go to the repository's Settings > "Security and quality" section of the sidebar > "Advanced Security." Under "Secret Protection," click "Enable," then turn on "Push protection." You'll also see options for "Validity checks," generic patterns, AI-detected secrets and "Custom patterns" > "New pattern." The docs on [enabling secret scanning](https://docs.github.com/en/code-security/secret-scanning/enabling-secret-scanning-features/enabling-secret-scanning-for-your-repository) and [enabling push protection](https://docs.github.com/en/code-security/how-tos/secure-your-secrets/prevent-future-leaks/enabling-push-protection-for-your-repository) cover the steps.

### Across an organization

Organizations use security configurations, saved bundles of settings you apply to many repositories. Go to your organization's Settings > "Security" section > "Advanced Security" > "Configurations" > "New configuration" > "Custom configuration." Pick the Secret Protection, Code Security and dependency scanning options, set the Policy to use it as the default for new repositories, click "Save configuration," then apply it. A default applies only to new repositories, so transferred ones need it applied manually.

### Across an enterprise

On GitHub Enterprise Cloud, enterprise owners and members with an admin role go to the enterprise's Settings > left sidebar "Advanced Security" > "Security configurations" > "New configuration." The process is described in GitHub's page on [creating a custom security configuration for your enterprise](https://docs.github.com/en/enterprise-cloud@latest/code-security/how-tos/secure-at-scale/configure-enterprise-security/establish-complete-coverage/creating-a-custom-security-configuration-for-your-enterprise). GitHub also documents a named "GitHub recommended" configuration. This post didn't confirm exactly what it switches on, so read its docs page before you rely on it.

### Bypass rules and custom patterns

By default, anyone with write access can bypass push protection by giving a reason, and every bypass creates an alert, an audit log entry and an email to owners and security managers. For tighter control, enable [delegated bypass](https://docs.github.com/en/code-security/how-tos/secure-your-secrets/manage-bypass-requests/enabling-delegated-bypass-for-push-protection) so designated roles or teams review bypass requests. For company-specific token formats, define [custom patterns](https://docs.github.com/en/code-security/how-tos/secure-your-secrets/customize-leak-detection/defining-custom-patterns-for-secret-scanning) and use "Save and dry run" before you publish.

## Set up Dependabot

Dependabot is free on all plans, and it's the easiest layer to add. A few extras, such as assigning alerts, reachability analysis and custom auto-triage rules on private repositories, need a paid Code Security licence. Turn it on per repository at Settings > "Security and quality" > "Advanced Security" > Dependabot, where you'll find "Dependabot alerts," "Dependabot security updates," "Grouped security updates" and "Dependabot version updates." Enabling version updates creates a default configuration file in `.github` and turns on the dependency graph automatically, according to the [Dependabot quickstart](https://docs.github.com/en/code-security/getting-started/dependabot-quickstart-guide). In an organization, the same switches live in a security configuration's dependency scanning section.

For version updates you control behavior with `.github/dependabot.yml`. This minimal file covers npm packages and GitHub Actions, grouped weekly. It's composed from the documented syntax (`version: 2`, `updates`, `package-ecosystem`, `directory`, `schedule.interval` and the `groups` options), not copied from a docs example, and it's not run here.

```yaml
# .github/dependabot.yml  (composed from documented syntax, not run here)
version: 2
updates:
  - package-ecosystem: "npm"
    directory: "/"
    schedule:
      interval: "weekly"
    groups:
      npm-minor-patch:
        patterns: ["*"]
        update-types: ["minor", "patch"]
  - package-ecosystem: "github-actions"
    directory: "/"
    schedule:
      interval: "weekly"
    groups:
      actions:
        patterns: ["*"]
```

A few details from the [configuration docs](https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates) and the [options reference](https://docs.github.com/en/code-security/reference/supply-chain-security/dependabot-options-reference) are worth knowing before you commit the file.

- For `github-actions`, the docs say to use `/` as the directory. Dependabot then scans `/.github/workflows` and the root `action.yml`.
- A group identifier must start and end with a letter. A dependency that matches several groups goes to the first one.
- `open-pull-requests-limit` defaults to 5 for version updates, and 0 disables them. Security updates have a separate fixed limit of 10 that you can't change.
- Since July 2026, version updates apply a default cooldown of 3 days, meaning Dependabot waits until a release is 3 days old. Security updates aren't delayed. The options reference documents the `cooldown` setting if you want to change that, and we didn't verify the exact syntax for turning it off.

## TruffleHog and the verification warning

TruffleHog is an open-source scanner from Truffle Security. Its [README](https://github.com/trufflesecurity/trufflehog) describes scanning git repositories, GitHub organizations and filesystems, among other sources. It's licensed AGPL-3.0. The latest release listed on its releases page on 2026-11-12 was v3.99.8, though the page didn't show a year.

### Read this before your first scan

Verification appears to be on by default. That's an inference from the `--no-verification` opt-out flag and the default results including verified ones, because the README only says TruffleHog "can" verify. Either way it makes live calls when it does. The README says that for every secret TruffleHog can classify, "it can also log in to confirm if that secret is live or not." A verified result means TruffleHog tested the credential against the service's API. Results come back as verified, unverified (may be invalid, expired, or verification was disabled) or unknown (verification was attempted but failed, for example on a network error). Default output includes verified, unverified and unknown results. Truffle Security's [post on how verification works](https://trufflesecurity.com/blog/how-trufflehog-verifies-secrets) describes verification as stateless, saying it doesn't alter data or create new resources.

Here's why that matters at work. A scan can send each credential it finds to the provider that issued it. Those calls can look like suspicious activity to a managed security monitoring service or your security team, and they may show up in cloud-side logs and in endpoint or network telemetry from the scanning host. The evidence comes from third parties. Thinkst's help article on its Canary tokens says the verification process "will trigger an alert that someone has used" a Slack or AWS API key Canarytoken, per their [TruffleHog alert annotation page](https://help.canary.tools/hc/en-gb/articles/18185364902813-Alert-Annotation-TruffleHog-Scan). Truffle Security's README and verification post, as far as we could find, contain no caution or guidance about notifying a security team. So the advice to warn your team first is our opinion, built on documented behavior.

You have two safe options. Turn verification off with `--no-verification`, which the program's own flag text describes as "Don't verify the results." Or tell your security team before you scan, so they can expect the calls. Doing neither in a workplace isn't a good idea.

### Commands

The first four commands below come from the README (not run here). The last two show the verification choices.

```bash
# Scan a repository's git history, showing only verified results (not run here)
trufflehog git https://github.com/trufflesecurity/test_keys --results=verified

# Scan every repository in a GitHub org, skipping archived ones (not run here)
trufflehog github --org=trufflesecurity --exclude-archived

# Scan files and folders on disk (not run here)
trufflehog filesystem path/to/file1.txt path/to/dir

# Scan the current repo's changes against main, exit code 183 if matching results are found (not run here)
trufflehog git file://. --since-commit main --branch feature-1 --results=verified,unknown --fail

# No live credential checks: every match is reported as unverified (not run here)
trufflehog git file://. --no-verification

# Keep verification, but only print results the provider confirmed or couldn't check (not run here)
trufflehog git file://. --results=verified,unknown
```

The `--results` flag chooses which statuses to print: verified, unknown, unverified or filtered_unverified. That doesn't turn verification off. Note that `unknown` only exists because a verification attempt happened. With `--no-verification`, expect more noise, since every match is unverified.

### A minimal GitHub Actions workflow

This file is composed from README fragments and isn't run here. Because the README example uses `--results=verified,unknown`, verification still runs in this version. To stop outbound credential tests, put `--no-verification` in `extra_args` as shown.

```yaml
# .github/workflows/trufflehog.yml  (composed from README fragments, not run here)
name: trufflehog
on:
  push:
    branches: [main]
  pull_request:
jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: trufflesecurity/trufflehog@main
        with:
          extra_args: --no-verification
```

The README uses `@main`. In our opinion, pin the action to a release tag or commit SHA instead.

## Gitleaks as a free scanner

[Gitleaks](https://github.com/gitleaks/gitleaks) is MIT-licensed and free. It detects secrets with regular expressions and entropy checks. The README doesn't describe any validation against live APIs, so as far as we can tell it sends no credentials to providers, which is its main practical difference from TruffleHog's defaults.

Two caveats from the README and releases page, checked 2026-11-12. First, the README banner says Gitleaks is "feature complete" and that the maintainer isn't merging new features, with future releases limited to security patches. It says the author is shifting focus to Betterleaks, a separate project this post didn't inspect, and the latest release listed was v8.30.1 from March 2026. Second, the official GitHub Action, `gitleaks/gitleaks-action@v3`, requires a free license key from gitleaks.io if you scan repositories owned by an organization account, stored as an encrypted secret named `GITLEAKS_LICENSE`. Personal accounts don't need a key. Running the binary directly in CI needs no key.

### Commands

The README says v8.19.0 deprecated `detect` and `protect`; both still work but are hidden from `--help`, so use the newer subcommands.

```bash
# Scan git history (not run here)
gitleaks git

# Scan a directory or files on disk without git history (not run here)
gitleaks dir .

# Save a report, then use it as a baseline so later scans show only new findings (not run here)
gitleaks git --report-path gitleaks-report.json
gitleaks git --baseline-path gitleaks-report.json
```

### Pre-commit hook

The README's pre-commit example pins `v8.24.2`, which is stale. The current tag listed on 2026-11-12 was v8.30.1, so we use it below (not run here). Check the [releases page](https://github.com/gitleaks/gitleaks/releases) and pin the latest tag when you copy this, because it will change.

```yaml
# .pre-commit-config.yaml (hook layout from the Gitleaks README, version updated, not run here)
repos:
  - repo: https://github.com/gitleaks/gitleaks
    rev: v8.30.1   # pin the latest release tag when you copy this
    hooks:
      - id: gitleaks
```

Run `pre-commit install`. To skip the hook for a single commit, the README shows `SKIP=gitleaks git commit`, which you should reserve for real exceptions.

### Allowlist example

A `.gitleaks.toml` allowlist silences known false positives. This follows the README's global allowlist structure, with obviously fake values (not run here). Rule-level allowlists use `[[rules.allowlists]]`, and the README says a finding is ignored if any allowlist condition matches.

```toml
# .gitleaks.toml (structure from the Gitleaks README, example values, not run here)
[[allowlists]]
description = "global allow list"
paths = ['''docs/fixtures/.*''']
regexes = ['''AKIAIOSFODNN7EXAMPLE''']
```

`AKIAIOSFODNN7EXAMPLE` is the placeholder access key ID from AWS documentation, which makes it a safe stand-in. Keep real allowlists small, because every exception is a place a real secret could hide.

## Comparison table

| Tool | What it does | What it doesn't do | Runs where | Cost (checked 2026-11-12) | Verification |
|---|---|---|---|---|---|
| GitHub secret scanning | Scans repository content and history with partner and custom patterns, optional validity checks | Doesn't scan dependencies; private repos need a paid plan | GitHub servers | Free on public repos; Secret Protection $19 per active committer per month for private | Validity checks, if you enable them |
| GitHub push protection | Blocks pushes that contain recognized secrets | Can be bypassed with a reason unless you set delegated bypass; only catches patterns it knows | GitHub servers, at push time | Same as above; AI-detected blocking uses AI Credits | Not applicable |
| Dependabot | Alerts, security update pull requests and version update pull requests for dependencies and Actions | Doesn't find secrets at all | GitHub servers | Free on all plans (some extras are paid) | Not applicable |
| TruffleHog | Scans git, GitHub orgs and filesystems for secrets | Doesn't scan dependencies; verification makes live provider calls (appears to be on by default) | Your CLI, CI or pre-commit | Free and open source (AGPL-3.0) | Appears on by default; `--no-verification` turns it off |
| Gitleaks | Regex and entropy secret scanner for git, directories and stdin | No verification, no dependency scanning, security patches only per its README | Your CLI, CI or pre-commit | Free (MIT); the Action needs a free license key for org repos | None |

## Layered setups for three situations

These setups are opinion, built from the capabilities described above.

### Solo developer or public repositories

Secret scanning and push protection are free on public repositories, so confirm they're both enabled on each repository. User-level push protection is on by default, but repository-level push protection is off by default. Add Dependabot alerts, security updates and version updates with the `dependabot.yml` above. Optionally add Gitleaks in a pre-commit hook, or TruffleHog with `--no-verification`.

### Small team on private repositories without paid features

Use Dependabot, which is free, and run Gitleaks or TruffleHog in pre-commit and CI. If you pick the Gitleaks Action for an organization, get the free license key, or run the binary directly. GitHub's own secret scanning for private repositories is paid, so weigh $19 per active committer per month against the effort of maintaining open-source tools. These scanners only block anything if you make the hook or CI check mandatory. If your organization is on GitHub Team, the free secret risk assessment gives a one-off view of exposure.

### Organization on GitHub Enterprise Cloud

Buy Secret Protection, and Code Security if you need it. Apply settings through enterprise or organization security configurations, make them the default for new repositories and enforce them. Turn on push protection with delegated bypass, validity checks, and custom patterns after a dry run. Run the secret risk assessment first. Configure Dependabot through the same configuration. If you also want TruffleHog, tell your security team before the first scan, and consider a scheduled scan only after they've agreed to the verification traffic.

## What to do when a scanner finds a secret

Treat every real finding as exposed, because git history and clones keep the value even after you delete the file. Revoke or rotate the credential first, then check the provider's logs, then clean up the repository. Our companion post walks through each step: [what to do if an API key leaked in a GitHub repo](https://stevenphan.ca/blog/what-to-do-if-api-key-leaked-in-github-repo/).

## FAQ

### Is Dependabot enough to protect my GitHub repo from leaked secrets?

No. Dependabot finds known-vulnerable and outdated dependencies and opens pull requests to fix them. It doesn't look for hardcoded secrets. For credentials you need secret scanning with push protection, or a scanner such as TruffleHog or Gitleaks.

### Is GitHub secret scanning free for private repositories?

Not on the plans GitHub documents. Secret scanning and push protection are free for public repositories, but GitHub's docs say you need to pay for these features in private repositories, through Secret Protection on a Team or Enterprise Cloud plan. The docs don't spell out the Free plan separately. As of 2026-11-12 the list price is $19 USD per active committer per month, and the [GitHub security plans page](https://github.com/security/plans) has the current figure.

### Does TruffleHog verification trigger security alerts?

It can. Verification appears to be on by default and sends each found credential to the issuing service to check whether it's live. Thinkst documents that this triggers alerts on its canary tokens, and the TruffleHog README doesn't address alerting. Use `--no-verification` or warn your security team before scanning.

### How do you turn off TruffleHog verification?

Add the `--no-verification` flag, for example `trufflehog git file://. --no-verification`. Every match is then reported as unverified, so expect more noise.

### Is Gitleaks free, and is it still maintained?

Gitleaks is MIT-licensed and free to use. Its README says the project is feature complete and that future releases will be security patches only, with the author shifting focus to Betterleaks. The latest release listed on 2026-11-12 was v8.30.1 from March 2026, and the organization version of its GitHub Action needs a free license key.

### Where do you turn on push protection in GitHub now?

In a repository, go to Settings > "Security and quality" > "Advanced Security" and enable Secret Protection, then Push protection. For many repositories, use a security configuration under the organization's Settings > Security > Advanced Security > Configurations.

## Where to go next

If a scanner already found something real, start with the companion guide on [what to do if an API key leaked in a GitHub repo](https://stevenphan.ca/blog/what-to-do-if-api-key-leaked-in-github-repo/). Then check the [GitHub security plans page](https://github.com/security/plans) for current pricing, read the [GitHub security features overview](https://docs.github.com/en/code-security/getting-started/github-security-features) to see what your plan includes, and review the [TruffleHog](https://github.com/trufflesecurity/trufflehog) and [Gitleaks](https://github.com/gitleaks/gitleaks) READMEs before you add either to CI.
