Sub topic 3
What GitHub recognizes: provider patterns and secret types
This chapter assumes you know what secret scanning does at a high level: it looks through repository content for credentials. Here you learn what it can actually recognize, and why that matters when you read alerts and plan coverage.
Two families of detection
GitHub does not search for "anything that looks secret." It matches content against defined patterns. There are two main families.
- Provider patterns are written for tokens issued by specific services, such as cloud platforms, payment processors, and package registries. Each pattern reflects the format that provider uses.
- Generic patterns target credentials that have no single issuer, such as passwords or private keys, and rely on broader heuristics.
Provider patterns are usually precise. A token with a distinctive prefix and a fixed length is rarely confused with ordinary text, so alerts from these patterns tend to be worth acting on quickly. Generic detection casts a wider net and can produce more false positives.
Secret types
Every alert is tagged with a secret type. This is the name of the pattern that matched, for example a provider's access token or a private key. The type tells you three practical things:
- Which provider or system issued the credential, and therefore where you must go to revoke it.
- How much trust to place in the match. A well-defined provider token is a stronger signal than a generic match.
- Whether extra features, such as validity checks, apply to it.
The API returns the readable name in the field secret_type_display_name. You will see it again when you list alerts from the command line.
Where patterns come from
Provider patterns are mostly contributed through GitHub's partner program, which a later chapter covers. For now, note the consequence: coverage grows as providers join, and the list of supported patterns changes over time. Check GitHub's current documentation for the supported secret list instead of relying on a fixed list in your notes.
What is not covered
Pattern matching has limits, and knowing them prevents false confidence.
- Internal credentials. A token format unique to your company has no provider pattern. You need a custom pattern for it, which is a later topic.
- Unusual formats. A secret that is split across lines, encoded, or stored in a form the pattern does not expect may not match.
- Low-structure secrets. A short, human-chosen password has no recognizable shape, so detection is unreliable.
A clean alert list therefore means "no known patterns matched," not "no secrets present."
Seeing types in practice
Listing open alerts shows the type on each one. This command prints the number, type, validity, and bypass status:
gh api 'repos/OWNER/REPO/secret-scanning/alerts?state=open' \
--jq '.[] | {number, secret_type_display_name, validity, push_protection_bypassed}'Group the output by secret_type_display_name and you can see which providers you must contact for revocation, which is the first step of remediation.
Exercise
An alert shows a secret type for a specific cloud provider's access token. Why does the secret type matter for your response, and why does an empty alert list not prove a repository is free of secrets?
Show answer
The secret type identifies the issuer, so it tells you where to revoke the credential, and it indicates how reliable the match is. An empty list only means no supported pattern matched. Internal token formats, encoded or split values, and short passwords can go undetected unless you add custom patterns.