Detectors
The git-history engine and the local pre-commit check run 189 detectors: 12 first-party rules written for this product, and 177 adopted from the open-source gitleaks project’s default configuration (version 8.30.1, MIT licence, attributed in the product’sNOTICE).
History scanning is off until an operator turns it on.
Without it, a repository scan’s secret detection looks at the working tree with
the 106 built-in rules of the open-source scanning engine, not these detectors.
Everything below about rules, commit attribution and validity checks describes
the git-history engine.
First-party rules
Each is a format-specific pattern, and every one that has a checksum or a structural check verifies it: a plausible-looking string in a test fixture or a vendor’s own documentation is not a finding.Provider detectors
The adopted detectors cover 119 providers. Each pairs a pattern with keywords that must appear on the same line, and the ones whose format has no distinctive prefix also require the matched value to clear an entropy threshold, so a placeholder such asxxxxxxxxxxxxxxxx is not reported.
All 177 provider detectors
All 177 provider detectors
scripts/gen_secret_detectors.py.
How the detectors are verified. Every detector has a true-positive line it
must report and a false-positive line it must not
(backend/internal/scanner/secrets/testdata/detector_fixtures.json, 378
lines), run through the same detection path a scan uses. The 12 first-party
fixtures are hand-written. The 177 provider fixtures are synthesised from each
detector’s own pattern: they prove the detector fires on its format and
ignores a near miss, and they are not credentials any provider issued. No
detector has been measured for precision or recall against a corpus of real
leaks.
A provider detector fires only when its keyword is on the same line as the
value. A token whose format carries the provider’s prefix (dop_v1_…,
hf_…, sk-ant-…) always satisfies that. A token with no prefix, such as a
32-character Datadog key, is reported only when the line also names the
provider, for example DATADOG_API_KEY=….
Test keys are reported, not filtered. A sk_test_… Stripe key routinely
reads real customer data copied in for debugging, and a repository whose
practices leak the test key will leak the live one. Severity is a triage
decision, not a detection one.
Two files, two leaks. The same credential committed to two files is two
findings with two remediations: each file has to be edited. Renaming a file
that contains an already-leaked credential is tracked as two observations
of one credential today, because rename detection is deliberately disabled
during the history walk (a similarity heuristic is itself attacker-influenced
input). The credential’s own identity (a salted digest of its bytes) is
identical either way, which is what makes rotation trackable by digest rather
than by location. See Remediation below.
Who introduced it
A secret found in history names the commit that first introduced it and that commit’s author, as structured fields on the finding’ssecret evidence,
namely introduced_commit and introduced_author (Name <email>, as git
recorded it), and as Introduced by on the finding in the dashboard. That is the
person to ask where else the credential was used before you rotate it.
Attribution is evidence, not identity. A history rewrite or a corrected
author email changes these fields without making the leak a new finding, so
triage and suppression history survive it. A scan with no commit history to
walk leaves both fields absent.
Validity checking
Finding a credential and knowing it still works are different facts. 27 detectors have a validity check, across 22 providers with a safe, read-only “who am I” endpoint on a fixed host. For those, TRUSTIVAN can ask the credential’s own provider:
Every one of those URLs is a literal string in TRUSTIVAN’s code.
None is built from anything a scan observes (not the host, not the path),
so nothing in a repository can redirect the check anywhere else. Every
request goes through the same guarded transport as the product’s other
outbound calls, which refuses private, loopback and link-local addresses.
The credential travels in exactly the header or body position its own
provider’s auth scheme documents, is never placed in a URL, is never logged,
and is discarded the instant the provider answers; only the verdict and a
timestamp are stored.
How a provider’s answer is read:
403 is unknown on purpose. A provider answers 403 to a credential it
recognises but will not let do this one thing: a token without the scope the
endpoint needs, a restricted key, a rate limit. That credential is live, and
reporting it as rejected would tell you a leak had already been dealt with.
(Before this release a 403 was recorded as invalid.) Slack answers 200
either way, so its verdict is read from the response body.
What the checks are tested against. Each provider’s check is exercised
against response fixtures written from that provider’s API documentation
(backend/internal/scanner/secrets/testdata/validity_responses.json). They
were not captured from the live services, and TRUSTIVAN’s test suite never
calls a provider. So the tests establish what TRUSTIVAN sends and how it
reads each documented answer; they cannot detect a provider changing its API.
Not covered, and there is no plan to fake it:
- AWS, Twilio and other paired credentials. An AWS access key ID cannot authenticate without its secret key, which this scanner does not correlate across a file.
- Database URLs, and providers whose host is part of the account (Mailchimp, Shopify, Okta, Zendesk). “Validating” them would mean TRUSTIVAN connecting to a host a repository named, which is exactly the server-side request forgery every other outbound path in this product exists to refuse.
- Providers with regional or self-hosted endpoints (Datadog, Sentry, Typeform, LaunchDarkly, Intercom, Snyk, and Terraform Cloud, whose token format Terraform Enterprise shares). Asking the wrong region reports a live key as unknown or rejected.
- The Dropbox app-key detector (
secrets.dropbox.api-token). It matches an app key, not an access token, and no endpoint accepts a key on its own. - Providers that take the credential in the URL (Telegram, Google API keys), where it would land in access logs.
- Private keys, JSON Web Tokens and the generic high-entropy rule, which have no provider to ask.
- The other 162 detectors, which simply have no check written.
Turning it on, and off
Off by default, for every organization. Turning it on makes TRUSTIVAN present your own discovered credentials to their own providers on your behalf. That is a decision only an owner or admin can make, and only a human, never an API key. Use Settings → Security → Check discovered secrets for validity in the dashboard while signed in as an owner or admin. The API route behind that switch isPUT /api/v1/settings/secret-validity
with {"enabled": true} or false. It needs organization:manage, which no
API key can hold, so it accepts a signed-in owner’s or admin’s browser
session only; an API key gets 403. Any member, or a key with
findings:read, can GET the same path to read the current setting. A
deployment whose operator has not enabled validity checking at all answers
501.
Turning it off stops every future check; verdicts already recorded on
existing findings are not erased, because a credential that was live an hour
ago is still evidence. A change to this setting is written to the
deployment’s application log, not to the organization’s
audit trail.
A confirmed-live credential is raised to critical severity: this is
no longer “a string shaped like a key,” it is one the provider accepted
moments ago.
Pre-commit check
trustivan secrets scan --staged runs the same detector set locally,
against exactly the lines about to be committed, with no network call at
all. Everything above tells you about a leak that already happened; this
catches one before the commit is made.
0 means clean, 1 means a secret was found (the commit should
stop), 2 means the command itself could not run (no git, not a repository).
Only added lines are scanned: a secret already in the file before this
commit is the history engine’s job, not this command’s, and re-flagging it on
every unrelated commit that happens to touch the same file is how a
pre-commit hook gets disabled.
Pre-commit hook
CI
git diff origin/main...HEAD) with your
own wrapper, or rely on gate’s repository-target scan, which reads the
full clone rather than the index.
Remediation
POST /api/v1/findings/:id/rotate records that a credential has been
rotated or revoked: who, when, and a required note. This is not a
status change: the finding stays open, because the credential is still
readable in the repository’s history regardless of what you do to it at the
provider, and marking it “resolved” would misrepresent that. What you get is
a durable record (a secret_rotated timeline event and a badge on the
finding) so a rotated credential doesn’t sit in the backlog looking
unaddressed.
Limitations, stated honestly
- Only 16 of the 189 detectors have a validity check, and those checks are tested against documented response shapes, not live providers. See above.
- No server-side push blocking. The pre-commit check is local and can be skipped.
- Detection is line by line. A credential split across lines, or one whose identifying keyword is on a different line, is not found by the provider detectors. There is no per-repository allowlist file; suppress a false positive on the finding.
- A file rename is tracked as two observations, not one continuous finding, because rename detection is disabled during the history walk.
- Shallow clones are refused by default. A credential introduced before a shallow clone’s earliest commit cannot be found in it, and TRUSTIVAN will not report a shallow scan as a clean one.
secrets scan --stagedonly reads the git index. It does not scan history, and it is not a replacement for the git-history engine: it is the complement to it.