Skip to content
Secret types

Learn

Secret types

A is anything that lets software or a person prove who they are, or unlock data: an API key, a password, a private key. Knowing which kind you’re looking at tells you how it was likely leaked, how a scanner finds it and who has to fix it.

Kinds of secret

Mostly grouped by the form the secret takes. Cloud is the exception: keys from cloud and hosting providers sit together because they usually reach the most. Each kind leaks, gets found and gets fixed a little differently.

TruffleHog counts are from commit 2325546. The grouping is a draft: rules place each detector in the most specific kind that fits, pending review.

API keys and access tokens

A single string that lets a program call a service's API.

The most common kind. Many services give their keys a recognizable prefix, which makes them easier to find and harder to mistake for random text. Access depends on how the key was scoped when it was created.

In TruffleHog: 815 of 894 detectors

For example GitHub, Stripe, OpenAI and Slack

Search all 815

Cloud and infrastructure credentials

Keys from cloud, hosting and infrastructure providers.

Often an ID and secret pair, or a service account key file. These can reach compute, storage and identity settings, so the blast radius depends on the attached role or policy.

Passwords and connection strings

A database or service address with the username and password built in.

For example a postgres:// or mongodb:// URI, or a URL with credentials in it. The password usually has no recognizable format, so scanners rely on the surrounding structure instead.

Private keys and certificates

Cryptographic key material, such as SSH, TLS or PGP private keys.

Usually a block with a BEGIN … PRIVATE KEY header. Whoever holds it can prove an identity or decrypt data, and the matching public key is often trusted in many places. In TruffleHog, one detector covers SSH, TLS and PGP keys.

In TruffleHog: 1 of 894 detectors

For example Private Key

OAuth and client credentials

An app's client ID and secret, or the access tokens an app gets with them.

The client ID and secret identify the app and are found as a pair; the secret is what matters. An access token lets its holder act for a user until it expires.

How they're found

How TruffleHog narrows text down to a finding.

  1. Step 1

    A keyword shows up

    Every lists keywords, such as a provider name or a known key prefix (ghp_ for GitHub, AKIA for AWS). A detector only runs on text where one of them appears, which keeps scans fast.

  2. Step 2

    A pattern matches

    A regular expression then picks out the secret. 744 detectors look for it close to a keyword; 150 match on the secret’s own shape.

  3. Step 3

    The shape sets the odds

    A key with a fixed prefix is easy to spot with few false alarms. A plain password has no format, so scanners lean on what surrounds it, like the postgres:// prefix and the @host after the password in a connection string.

  4. Step 4

    Optionally, check it's live

    Many detectors can ask the provider whether the secret still works (), which separates a live key from a revoked one or an example.

The full TruffleHog scan pipeline, with source lines

Things that look like secrets but aren't

Patterns catch these too. On their own they don't let anyone in.

Identifiers
An AWS access key ID, an OAuth client ID or a username names an account. On its own it doesn't let anyone in, but it often sits next to the part that does.
Public keys and certificates
Meant to be shared. The matching private key is the secret.
Placeholders and examples
Strings like YOUR_API_KEY or keys from documentation look real to a pattern but grant nothing. Checking whether a key works is one way to tell them apart.

Where to next