Repository navigation
v1.0.0
Added
-
Repository skeleton: Go module, package layout,
tokenhound --help. -
Apache-2.0 licence for the code and CC0-1.0 for registry data; contributing,
security, governance and code of conduct documents. -
Lint gates for architecture rules (secret reveal, HTTP clients, error text, stage
imports) with a self-test, a dash lint, a cross-OS CI matrix, CodeQL and GoReleaser
snapshot builds. -
Provider registry: JSON Schema (
registry/schema/provider.json), embedded snapshot
2026.11.13with OpenAI (project, service account, admin and legacy user keys) and
Anthropic (API and admin keys), a validating loader that reports
file:line: field: message,_template.yaml, thetools/testkeysgenerator,
make registry-testand themake registry-idsid stability check. -
CLI root with global flags (
--format,--config,--no-verify,--deterministic,
--no-color,--plain,--quiet,-v/--verbose,--log-format text|json),
log/sloglogging to stderr and one-line usage errors with the correct form (exit 2). -
tokenhound versionshows the version, commit, build date, registry snapshot and
schema version;tokenhound providerslists every provider with its detectors,
verify host and revoke URL. Both support--format json. -
Finding and Report model in the root package (statuses with live, unverified and
dead classes, confidence, grades, locations, targets, warnings) and the JSON Schema
docs/schema/report.v1.json(schema_version: 1, USD with two decimals, RFC 3339
UTC times). -
internal/secret.Secret, an opaque key type whose every print, marshal and log
path shows only the redacted form (sk-pro...a1b2 (51)), never more than half of
a key; theth_fingerprint id;internal/warnxwarnings built from error codes
without error text; and the internal detect-to-verify candidate envelope. -
Library scan API:
tokenhound.Scan(ctx, Options)withPath,StdinandReader
sources,Results.Events()progress events (finding-detected,location-added),
Results.Wait()for the final Report andResults.Findingsfor range loops;
Options.Timeoutreturns partial results with atimeoutwarning per incomplete
source, andOptions.Deterministicpins the generated time and duration. -
Scan engine: source, decode (pass-through for now), detect, suppress, verify
(verification off for now), enrich, grade and fix plan stages over bounded
channels withGOMAXPROCSworkers; each stage has one interface and an adapter
registry. The working tree source skips.git, never follows symlinks inside the
tree, reads plain files only (no archive expansion) and names the target after the normalisedoriginremote;
unreadable files becomefile_unreadablewarnings. Detect matches every registry
pattern, dedupes each key into one finding with every location, picks one winning
detector (keyword context, then confidence, then id) and lists the others in
also_matched_by. Generated test keys are suppressed astest_markerunless
IncludeTestKeysis set. Findings, locations, targets and warnings are sorted
deterministically. -
tokenhound scan [path|-]scans a directory, a file or standard input and prints
the JSON Report (--format json) or a minimal terminal summary (meta line, count
line, one row per finding with status word, provider, redacted key and first
location).--include-test-keyskeeps generated test keys unsuppressed;-o
writes one format to a file, or several formats (--format json,terminal) to a
directory astokenhound.jsonwith the summary on stdout. When stdout carries JSON
or everything goes to files, the summary goes to stderr unless--quiet. Exit
codes: 0 nothing matchedfail_on(default: unsuppressed live keys), 1 something
did, 2 usage or fatal error. -
report.Render(w, format, *Report)with thejsonandterminalreporters;
meta.files_scannedin the Report and its schema;tokenhound.ErrRegistryfor a
broken embedded registry. -
make leak-test(also a CI job on Linux, macOS and Windows) fails if any output or
debug log contains more than 10 characters of a generated key;make self-scan
(also a CI job) scans this repository and fails on any unsuppressed finding. -
Configuration:
tokenhound.yaml(project tier, or--config), the user file
<user config dir>/tokenhound/config.yaml,TOKENHOUND_*environment variables
and flags, resolved once with that precedence by the new publicconfig.Loadinto
tokenhound.Options, which gains typedVerify,FailOn,Grade,Limits,
Network,Hook,Alerts,PingandWarningsfields. The published schema
docs/schema/config.v1.jsonlists every key; a missingversionmeans 1 and any
other version exits 2. Schema errors print asfile:line: field: messageand fail
every verb with exit 2. Trust tiers:network.*,alerts.*,hook.*andping
are honoured only from the user tier; a project file may not disable verification,
settimeout, lower alimits.*value orverify.timeout, raise a limit above
4x its default, or raisegrade.f_threshold_usd_per_dayor
verify.max_concurrency; a projectfail_onmay only tighten (unioned on top of
every layer, flags included);${NAME}expands only in the user tier (also inside
one-line{ ... }mappings, so the documented example parses as written) and
project paths must stay inside the root;
ignored values becomeuntrusted_config_keyandconfig_path_outside_root
warnings in the log and the Report. The library never reads config or env itself. -
scanexits 1 perfail_on: statuses,min_dollars_at_risk(a missing amount
counts as 0) and warning codes; withCI=true,fail_on.warningsdefaults to
[timeout]. New scan flags--fail-on-status,--fail-on-warnings,
--fail-on-min-dollarsand--timeout;--no-verifyand--config(paths inside
it resolve against the scan root) are wired, and--no-verify=falsechanges nothing. Config files
must be regular files: a FIFO, device or directory is a config error, never a hang.
Durations must be greater than 0, andverify.timeoutandalerts.timeoutat most
5m. An emptyTOKENHOUND_*variable counts as unset (an empty
TOKENHOUND_FAIL_ON_WARNINGSstill means no codes), and an empty
--fail-on-statusis a usage error. -
limits.max_file_bytes(default 10 MiB) bounds every file and stdin read; larger
input is skipped with afile_too_largewarning and not counted as scanned (add
file_too_largetofail_on.warningsto fail on it). The schema caps every
limits.*key (for examplemax_file_bytesat 1 GiB) and
verify.max_concurrency(64) in every tier.tokenhound helpand--helpnever load config, so a broken config cannot
block help. -
internal/netx, the one HTTP client factory: a closed purpose enum (verify,
registry,forge,alert,image,git,ping), host allowlists (literal
hosts and one-label*templates under a fixed suffix) checked before any dial,
HTTPS and TLS 1.2+ only, no redirects forverify, an HTTPS proxy over CONNECT
withno_proxyand credentials held as a secret, a CA bundle added to the system
pool, typed errors with codes and no URL, query or credential text, a process-wide
dial counter, andinternal/netx/netxtest(test CA, TLS server, CONNECT proxy). -
Decoding: the default decode stage now unwraps base64 (standard and URL-safe,
padded or not), percent-encoding, JSON escapes and env-file values in memory,
recursively up tolimits.decode_max_depth(default 3). A key found in decoded
content is located at the line and column where its encoded form starts in the
original file. Deeper nesting, or decoded output past 4 times the file size, stops
with a newdecode_depth_limitwarning (detailsmax_depth,size_budget).
Corrupt input is skipped silently and decoded content is never logged or printed. -
Confidence: computed per finding from one documented rule table
(docs/detection.md): declared pattern confidence, +1 with
keyword context on the match line or an adjacent line, -1 for prefix-less
patterns found in decoded content. Patterns withentropy.mindrop matches below
it. New registry fieldrequires_keywordsdrops prefix-less matches without
keyword context. -
Generic detector
generic.high-entropy(providergeneric): high-entropy values
assigned toapi_key,tokenorsecretnames, confidencelowormedium,
always losing to a provider detector on the same secret (listed in
also_matched_by). -
tools/testkeystemplates gainb64,b64url,pctandjsonescso fixtures
can hold generated keys in every encoding. -
Frontier providers (registry snapshot
2026.11.13.1):google-gemini,
google-vertex,azure-openai,aws,mistral,cohere,groq,xai,
deepseek,openrouterandperplexity, each with revoke, rotate and usage links
and a read-only verify request (gcp-key,azure-key,aws-sigv4against Bedrock
ListFoundationModels, orbearer). Prefix-less key shapes (Mistral, Cohere, Azure
keys, AWS secret access keys, Vertex AI keys) count only with keyword context. -
Multi-part credentials: detect pairs the parts of a credential
(credential.parts,same-fileorsame-surface-entry) within one file and what
was decoded from it, nearest by line, and reports one finding whose id covers every
part in declared order. A primary part without its partners is reported alone with
confidence: lowandstatus_reason: unpaired; a lone secondary part is not
reported. Pairing rules are indocs/detection.md. -
Provider schema: snake_case or kebab-case part names, a templated
verify.url
(https://<resource>.openai.azure.com/...) withverify.host_suffixes, template
labels constrained to[a-z0-9-]{1,63}, and an optional per-patternverifyblock
(AWS Bedrock API keys). The loader checks that templated hosts, suffixes and
placeholders agree. -
tools/testkeystemplates gain{{keypart "<provider>" "<part>"}}; boundary
groups such as(?:^|[^A-Za-z0-9])no longer add a character to generated keys. -
Complete provider registry (snapshot
2026.11.13.2, 26 providers):together,
fireworks,huggingface,replicate,elevenlabs,stability,voyage,
jina,pinecone,langsmith,langfuse,heliconeandcerebras, each with
revoke, rotate, usage and docs links and golden-tested generated keys. Only
huggingfacehas averifyblock in v1.0 (read-only GET of whoami-v2); the other
twelve are detect-only until verification lands. Langfuse is a two-part credential
(secret key primary, public key second,same-file): a lone secret key is an
unpairedlowfinding, a lone public key yields nothing. CI tests count the
providers (at least 25, all FR-1.2 ids) and reject anyverify.urlpath on the
generation endpoint denylist. -
Live verification (
internal/verify, adapterlive): one read-only request per
finding id, built only from the registryverifyblock (per-pattern block first)
and signed by an auth scheme (bearer,header,query,basic,azure-key,
gcp-key, stdlibaws-sigv4), sent throughnetxpurposeverify. Responses map
tolive,deadorunknown(unexpected_response,redirect,timeout,
network_error); 429 backs off exponentially (Retry-Afterhonoured, 3 retries)
and endsrate-limited. Per-provider token bucket, run-wide concurrency cap,
in-memory cache with singleflight, capped evidence extraction (org,tier,
scopes,limits) that drops any value holding a key part,status-updated
events, Reportproviders.<id>.verify_hostandverify_note, a read-only
per-pattern block for Anthropic admin keys, anddocs/verification.mdlisting every
endpoint as unconfirmed against live services.--no-verify,verify: falseand
TOKENHOUND_VERIFY=falsestill make zero dials. -
Spend registry and price exposure (snapshot
2026.11.13.3):registry/schema/spend.json
and oneregistry/spend/<provider>.yamlper provider (tiers, limits, most expensive
model, unit price, optional daily cap,spend_kind: data-accessfor observability and
vector stores), with a CI test that every provider has exactly one spend file. Prices
are written per large unit (price_unit_size, for example per 1M tokens) and read as
integer cents. Thespendenrich adapter setstier,scopes,org,
dollars_at_risk_per_day(live), 0 (dead) orpotential_dollars_at_risk_per_day
(unverified) and a fulldollars_method, with verified limits taking precedence over
tier defaults and the default tier flaggedassumed.tokenhound providers --spend
lists the tiers (--format jsonsupported). All spend figures are unconfirmed against
live pricing pages; seedocs/spend.md. -
Fix plans (snapshot
2026.11.17): every finding of a Report, including dead,
unverified and suppressed ones, carriesfix_planwith numbered steps{n, kind, title, detail, url, command, locations}in the order revoke, replace (every location,
plus the provider'senv_vars), purge (only with a commit or image location: a
git filter-repo --replace-textcommand with oneregex:line per credential part
built from the redacted form, length and registry pattern, never the key; a
--invert-pathsalternative for dotenv and npmrc-style files; a rebuild-without-layer
note for images), check usage and ScopeKeeper (always last, link from the new
requiredlinks.scopekeepersnapshot field). Links only, no network call.
internal/fixplan.Buildis the only implementation; the library adds
tokenhound.FixPlan(f),FixKindand its constants, andCredentialPart.
Multi-part findings carrycredential_parts(part name and redacted form). Providers
gain the optionalenv_varsfield. -
tokenhound fix <id> [path|-]: prints the fix plan of one finding with a header
(status word, provider, redacted key, dollars per day), aHow:line for metered
dollars figures (limit x price x 1,440, cap and tier source) and the numbered steps,
commands flush left on their own lines.--from <file|->reads a saved Report
(bounded to 64 MiB, checked formeta.schema_versionand validated against
docs/schema/report.v1.json) without scanning or any network call; without it, the
path is re-scanned through the public API with the scan flags (--history,
--since,--staged,--include-ignored,--include-test-keys,--timeout,
--no-verify,--config,--deterministic) and nothing is written.--format json
prints{schema_version, id, provider, status, redacted, fix_plan}.--openhands
an https revoke URL to the OS browser opener (newinternal/browser, the only
process start besides git, argument slices only); TokenHound never contacts a
revoke or rotate host. Exit 0 when the plan was printed, 2 for usage and input
errors. The report package addsreport.RenderFix. -
tokenhound scan --format sarif(Story 2.8): SARIF 2.1.0 for GitHub code scanning and
other SARIF consumers, to stdout, to an-ofile, or astokenhound.sarifwith several
formats and-o <dir>. One run per target (automationDetails.id
tokenhound/<kind>/<id>/), rules built from the Report's detectors and providers
(revoke and rotate links as help),error/warning/notelevels by status and
confidence, a title plus the redacted key as the message,partialFingerprints
tokenhound/v1set to the finding id so re-uploads do not duplicate alerts, file-like
locations relative to%SRCROOT%(commit and notebook cell as location properties),
surface, image and stdin locations as logical locations,suppressionsfor suppressed
findings (inSourcefor inline allows) andbaselineStatewhen the Report carries
baseline data. No snippets, timestamps or host paths. Onlyscantakes it.
Library:report.FormatSARIF,report.RenderSARIF. The OASIS schema is vendored as a
test fixture (seeNOTICE). -
Share card and README badge:
report.RenderCard(w, CardData)draws a 1200x630 PNG
(wordmark, the card sentence such as "2 live keys, $3,100 a day at risk, grade D",
the grade tile, a Hound amber rule and the footer) from a four-fieldCardData
(live count, dollars at risk per day, grade, optional label) derived with
report.CardDataFrom, so no path, provider, finding id or key can reach it. Fonts
(Inter, JetBrains Mono, SIL OFL 1.1) are embedded and glyphs are rasterized with
integer arithmetic, so the PNG is byte-identical on every OS and architecture; its
only text chunk is the alt text (report.CardAltText).report.RenderBadge(w, *Report)writes a shields.io flat-style SVG (tokenhound, then the grade, a middle
dot and the live count on the grade colour, the headline sentence as<title>, no
external references) sized with an embedded 11px Verdana width table (anafanafo,
MIT).tokenhound scan --format card|badgeexposes them (-o <file>, or
tokenhound.pngandtokenhound.svgin an-odirectory); a card prints
Alt text: ...and an<img>snippet on stderr, refuses to write to a terminal
(exit 2) and takes--card-label <text>(printable ASCII, at most 40 characters).
New dependency:golang.org/x/image. -
tokenhound scan --format gha: GitHub Actions workflow commands, one per location of
every non-suppressed finding in Report order.::errorfor live keys,::warning
for unverified high-confidence keys,::noticeotherwise;file,lineandcol
for file and staged locations (other kinds are named in the message); the title
carries the status, provider and dollars a day, the message the redacted key and the
first fix step. Text is escaped per GitHub's rules and printable ASCII only; an empty
Report prints nothing. UnderGITHUB_ACTIONS=truethe terminal summary on stdout is
printed in plain style and followed by the same annotations (also with--quiet).
The report package addsreport.FormatGHA(also throughreport.Render) and
report.GHAwithGHAOptions{NewOnly}, which lowers baselined findings to
::notice. -
make leak-testis the AD-3 release gate: one cross-reporter harness checks every
registered format, the terminal modes,report --from,fix, the baseline file and
the debug log over the full generated corpus with the sharedtools/testkeys/leakcheck
checker (raw, JSON-escaped, URL-encoded and base64 forms). -
tokenhound hook run --agent claude-code: a Claude Code PreToolUse hook that scans
only the proposed content (Bash command, Write content, Edit and MultiEdit new
strings, NotebookEdit new source, every string value of an MCP tool's input) and
answers in Claude Code's hook protocol. One shared policy ininternal/hook
(hook.mode: blockby default) blocks live and high-confidence unverified keys and
warns on dead and lower-confidence keys; a warning never grants permission.
Verification stops after 3 s (unknown/deadline); internal failures follow
hook.on_error(warn-allowby default) and show only a warning code. Inline
tokenhound:allowin proposed content is not honoured; projecthook.*keys are
ignored withuntrusted_config_key. Seedocs/hooks/policy.md. -
Library:
VerifyOptions.Deadline,Options.NoInlineAllowand
Source.WithTargetIDfor Reader sources; status reasondeadline. -
Report:
providers.<id>.env_var, the provider's conventional environment variable
from the registry'senv_vars(additive to schema v1). -
tokenhound mcp: a stdio Model Context Protocol server (official Go SDK v1.8.0) with
exactly four tools,scan,verify_status,fix_planandreport(json, sarif,
badge, card as a PNG image), each with JSON input and output schemas. Results carry
only redacted keys, locations, ids, counts and dollars; scans stay inside the
client's roots (or the working directory); the last Report of each session lives in
memory only; a second concurrent scan returnsscan_in_progressand a cancelled scan
keeps the previous results.--configand--no-verifyapply to every scan. Install
snippets for Claude Code, Codex, Cursor, Claude Desktop and VS Code are in
docs/mcp.md;server.jsonis the MCP registry manifest.make leak-testcovers
every tool output, progress notification and the debug log (TestLeakMCP). -
The GitHub Action (
aiagentpro/tokenhound-action, staged inaction/): a composite
action with bash, jq and gh scripts that downloads the pinned release, verifies
checksums.txtwithcosign verify-blobagainst the release workflow identity and
the archive's sha256 before running it, scans--since <base sha>with the base
branchtokenhound.yaml, ignore file and baseline, prints annotations, uploads SARIF
(categorytokenhound, SHA-pinnedupload-sarif), keeps one PR comment up to date
by its hidden marker (new findings, the binary's quiet headline, the baselined count
and a note when a config file changed in the PR) and falls back to the job summary
with one warning for fork PRs or missing permissions. Outputsgrade,live-count,
new-count,dollars-at-risk-per-dayandreport-dir. Black-box tests in
tests/action(part ofmake leak-test). -
--project-config <file>(same as--config; both is a usage error), and onscan,
reportand the bare command--ignore-file <file>and--baseline <file>, which
replace the project ignore file and the baseline file. Library:
config.Input.IgnoreFileandconfig.Input.BaselineFile. -
meta.path_prefixin the Report (additive to schema v1): the scan root relative to
its git top level.ghafile=and SARIF artifact URIs of file locations join it,
so a scan of a subdirectory annotates repository paths, also through
report --from. -
Agent skill
skills/tokenhound/SKILL.md(Agent Skills format): tells a coding agent
to call the TokenHound MCP tools (elsetokenhoundon PATH, elsenpx tokenhound,
always with--format json) instead of opening secret files, report findings by
headline and status with redacted keys only, walk each live key through its fix plan,
ask before anygit filter-repo, never revoke, and re-scan to confirm the key is
dead. Install for Claude Code, Codex and Cursor indocs/skill.md.make skill-lint
checks its commands, flags and MCP tools against the binary and bans dashes,
non-ASCII and key material;make leak-testruns its CLI commands on a fixture
(TestLeakSkillTranscript). -
tokenhound hook install|uninstall --claude-codeadds TokenHound's PreToolUse hook
(matcherBash|Write|Edit|MultiEdit|NotebookEdit|mcp__.*, command
<tokenhound> hook run --agent claude-code) to~/.claude/settings.json, or with
--projectto the repository's.claude/settings.json. Settings are edited through
an order-preserving JSON tree: every other key, hook and literal keeps its bytes,
indent and line endings, the write is atomic and symlink-aware, a repeat install
changes nothing, a stale TokenHound command is updated in place, and uninstall
removes only TokenHound's hooks so the file returns to its pre-install bytes. The
hook runs the absolute path of the running binary, ortokenhoundfrom PATH when the
binary sits in an npx, uvx, pipx orgo runcache;--commandoverrides. A settings
file that is not valid JSON, or no Claude Code on the machine (unless--force),
exits 2 without changing anything. Seedocs/hooks/claude-code.md.hook rungains
a hidden--include-test-keysfor end-to-end tests with generated keys. -
Session-end scan:
tokenhound hook install --claude-codealso adds a matcherless
SessionEndhook (<tokenhound> hook run --agent claude-code --event session-end,
"timeout": 10);--no-session-scanleaves it out and uninstall removes both.
hook run --event session-endscans only~/.claude/settings.json,
~/.claude/settings.local.json,~/.claude.json, the session cwd's
.claude/settings*.jsonand the session's transcript under~/.claude/projects/,
prints keys new since the last run in at most two stderr lines, and records them,
redacted, in<user config dir>/tokenhound/state/(claude-code-baseline.jsonin
baseline v1 format,last-session-findings.json). Baretokenhoundand
tokenhound agentsadd "N new keys found after your last Claude Code session" to
the meta line until the keys are fixed (tokenhound fix <id>) or gone. The run
reads only user-tier config, returns within 5 seconds and always exits 0; new
config keyhook.session_scan(default true, user tier only). See
docs/hooks/claude-code.mdanddocs/adr/0005-claude-code-session-end-hook.md. -
Library:
tokenhound.SurfaceFiles(surface, files...)scans exactly the given files
with a registry surface's parser and fields;HookOptions.SessionScan;
config.Input.UserOnlyresolves configuration without any project tier. -
Release chain (
.github/workflows/release.yml,RELEASING.md): release-please opens
the release PR and creates the tag and GitHub Release; GoReleaser then builds six
reproducible binaries with one SPDX SBOM per archive and a cosign keyless
checksums.txt.sigstore.jsonbundle, self-scansdist/and only then uploads the
assets. Release notes are this file's version section plus registry contributor
credits (tools/changelogrelease,tools/releasecredits). PR CI adds a workflow
lint (pinned actionlint andtools/workflowcheck),goreleaser checkand a
reproducible-build check;make workflow-checkandmake release-checkrun them
locally. -
npm packages so
npx tokenhoundworks (packaging/npm/): the main package
tokenhoundis a launcher with no install scripts that runs the native binary from
one of six exact-pinned optional platform packages@tokenhound/<os>-<arch>,
passing arguments, stdio, SIGINT, SIGTERM, SIGHUP and exit codes through. The
packages are built from the release archives after their sha256 is checked
against the signedchecksums.txt, and a separatenpm-publishrelease job
publishes them with provenance through OIDC trusted publishing (no npm token;
tools/workflowcheckrejects npm tokens outsidenpm-bootstrap.yml), skipping
versions already on npm and tagging backportsrelease-X.Yand prereleases
next.npm-bootstrap.ymlclaims the names once. CI runs the Node tests and
installs the packed tarballs on every OS;make npm-testand
make npm-install-testrun them locally. -
PyPI wheels so
uvx tokenhound,pipx run tokenhoundandpython -m tokenhound
work (packaging/pypi/):build_wheels.py(stdlib only) turns the release
archives, after their sha256 is checked against the signedchecksums.txt, into
eight byte-reproduciblepy3-nonewheels for macOS 12 or later (arm64, x86_64),
manylinux 2.17 and musllinux 1.2 (x86_64, aarch64) and Windows (x64, arm64). Each
installs the native binary as thetokenhoundscript; thetokenhoundpackage's
__main__.pyonly runs it with arguments and exit codes unchanged. No sdist,
Python 3.9 or later. A separatepypi-publishrelease job uploads them with
pypa/gh-action-pypi-publishthrough OIDC trusted publishing with PEP 740
attestations, skipping files already on PyPI (no PyPI token;
tools/workflowcheckrejects PyPI tokens and a publishpassword). CI runs the
Python tests on 3.9 and the default Python,twine check,check-wheel-contents
and installs each OS's wheel;make pypi-testandmake pypi-install-testrun
them locally. -
Homebrew, Scoop and
go installchannels: GoReleaser renders the cask
aiagentpro/tap/tokenhound(download URLs, sha256,binary "tokenhound"and one
macOS post-install step that removes the quarantine attribute) and
tools/scoopmanifestrenderstokenhound.jsonfrompackaging/scoop, both from
the signedchecksums.txt. A separatetap-publishrelease job commits them to
aiagentpro/homebrew-tapandaiagentpro/scoop-bucket, each with its own
repo-scoped token in the protectedtap-publishenvironment (tools/workflowcheck
confines both tokens to that job), and skips backports and pre-releases.tools/channelcheckchecks both against a snapshotdist/in CI
andmake release-check; ago-installCI job runsgo install ./cmd/tokenhound
on every OS. -
Security policy, threat model and supply-chain hardening:
SECURITY.mdadds the
90-day disclosure window, the supported-versions table (latest minor, security
backports to the previous minor for 6 months), the hooks, MCP, verification and
registry refresh scope, and how to verify a release (cosign verify-blob,
npm audit signatures, PyPI attestations;gh attestation verifyonce SLSA
provenance ships).docs/threat-model.mdcovers assets, seven trust boundaries and
STRIDE threats, each with its AD rule and the test, lint rule or CI job that proves
it;tools/threatmodelcheck(make threat-model-check, CIworkflow lint) fails
when a cited reference no longer exists. Atag-signaturerelease job
(scripts/tag-signature.sh) stops the release before anything is built unless the
tag resolves to the run's commit and that commit has a GitHub-verified signature;
tools/workflowcheckrequires every build and publish job to depend on it. New
scorecard.ymlpublishes the OpenSSF Scorecard weekly and onmain; CodeQL also
analyzes JavaScript and Python; Dependabot also coverspackaging/npmand
packaging/pypi, grouped weekly. The npm and PyPI release tool pins moved to
packaging/npm/package.jsonandpackaging/pypi/requirements-tools.txtso
Dependabot updates them;scripts/tool-pins.shis the one reader and rejects a
missing, duplicate or inexact pin (and npm older than 11.5.1).docs/security-setup.mdlists the maintainer steps
(private vulnerability reporting, branch protection, bestpractices.dev) and
docs/data/badges.yamlrecords the badge entries. -
Benchmark build tag (Story 4.9):
go build -tags benchmarkmakes a binary whose
verify calls are answered in process from a ground truth file
(TOKENHOUND_BENCH_TRUTH,docs/schema/bench-truth.v1.json) by the hex SHA-256 of
the credential as the request presents it, with a response that satisfies the
provider'slive_whenordead_whenand fillsverify.extract, or HTTP 429 for
rate-limited; unlisted credentials stayunknownwith the new status reason
not_in_ground_truth. Every other network purpose fails before any dial with the
newbenchmark_network_blockedwarning code (no v1.0 run uses such a purpose yet).
The CLI reportsX.Y.Z+benchmark(+meta.benchmarkwhen the version has build
metadata), prints "Benchmark build: verification answers come from ground truth."
on stderr, and every command,--helpandversionincluded, exits 2 without a
valid ground truth (bounded regular file, schema, and every entry checked against
the registry); library callers get no banner or suffix and aScanerror instead.
The report schema now lists everystatus_reason. Default builds are unchanged.
scripts/no-benchmark-tag.shfails any release or snapshot binary, loose or inside
the six archives ofchecksums.txt, with thebenchmarkbuild tag or the
responder's sentinel symbol or string (CIsnapshotjob, releasegoreleaserjob,
make release-check), and its
self-test proves a benchmark binary fails it;make test-benchmarkand the CI
testjob rungo test -tags benchmark ./.... Seedocs/benchmark.md. -
Published benchmark results in the README:
docs/benchmark/results.jsonholds the
newest published agent leak benchmark summary (seed 20261113, TokenHound,
gitleaks and TruffleHog with default and tuned configs, GitHub secret scanning
"not run yet"), and the block between<!-- benchmark:start -->and
<!-- benchmark:end -->is generated from it with precision, recall and "AI keys
in agent files found" per tool, linking the method and full results.
make bench-sync(the newestbenchmark/results/<date>/summary.json) updates both
(tools/benchsync);make bench-check, part ofmake ciand the CI
workflow lintjob, fails when the block drifts from the data. -
Container image and MCP registry listing (Story 4.7):
ghcr.io/aiagentpro/tokenhoundfor linux/amd64 and linux/arm64, built from
dist/docker/Dockerfileon the Chainguard git image pinned by digest, nonroot
(uid 65532), entrypointtokenhound, with OCI labelssource,version,
revision,licenses=Apache-2.0and
io.modelcontextprotocol.server.name=io.github.aiagentpro/tokenhound. A mounted
repository owned by the host user passes git's dubious-ownership check through the
image's read-onlyGIT_CONFIG_GLOBALfile, also when the runtime overridesHOME:
internal/gitxnow passesGIT_CONFIG_GLOBALto git when it is set (the system
config stays off and every hardening flag stays). A separatedocker-publish
release job builds it reproducibly from the release archives after their sha256 is
checked against the signedchecksums.txt, pushes it by digest, smoke-tests and
signs that digest with cosign keyless, and only then tags itX.Y.Z,X.Y,X
andlatest(backportsX.Y.ZandX.Y, pre-releasesX.Y.Zonly); it is the only job
withpackages: write(tools/workflowcheck). Themcp-registryjob then
rendersserver.jsonfrom the tag (tools/serverjson, validated against the
registry schema), now listing npm, PyPI and OCI packages (the OCI one mounts a
required{workspace}at/src), publishes it withmcp-publisherthrough GitHub
OIDC once the image is anonymously pullable, skips pre-releases, and checks the
registry API lists the version.
Ownership markers:mcpNamein the npm package and anmcp-name:line in the
PyPI description.scripts/docker-smoke.sh(make docker-smoke, CIdockerjob)
checks labels, user, entrypoint, version and a history scan of a fixture
repository owned by another uid; Dependabot also watchesdist/docker. -
Coding-agent baselines beside TokenHound:
make bench-syncalso copies each
published agent baseline of the benchmark on the same corpus
(benchmark/results/<date>/baseline-<agent>.json, Claude Code or Codex given a plain "find
leaked keys" prompt) todocs/benchmark/baseline-<agent>.json, and the README
benchmark block then shows TokenHound and each baseline side by side (precision,
recall, F1, keys missed, false alarms, keys called live correctly, model id, run
date). The drift check covers it. -
The README benchmark table shows F1, keys missed (FN) and false alarms (FP) beside
precision and recall for every tool, and notes that a missed live key is the
expensive error, so recall matters most for leak scanning. -
Governance and contributor onboarding (Story 4.14):
GOVERNANCE.mdnow covers
registry reviewers, the path to maintainer and the registry review rules (ids are
permanent);CODEOWNERSrequires a maintainer forinternal/secret,
internal/netx,.github/workflows/and.goreleaser.yamland registry reviewers
forregistry/;CITATION.cff(validated withcffconvert) and
.all-contributorsrc. CONTRIBUTING.md "Add a provider in 10 minutes" is a checked
guide: CI'sdocs-walkthroughjob (scripts/docs-walkthrough.sh) runs its
commands for a throwaway provider and fails past 10 minutes or when a schema error
stops printingfile:line: field: message; a newregistry/spend/_template.yaml
goes with it, the provider template's placeholder key prefix isxmpl_(not the
id, which golden files name), and the provider tests no longer pin the provider list. -
Issue forms
bug,false-positive(finding id, detector id and redacted form only),
providerandsurface(renamed fromprovider-requestandsurface-request), each
opening with a warning never to paste a full key;.github/labels.ymlwith a label
sync workflow (tools/labelsync); and theissue-guardworkflow, which scans new and
edited issues (title and body) and comments, pull request comments included, with
tokenhound scan - --no-verify, counting findings an inlinetokenhound:allowwould
suppress, and on a finding posts a fixed rotation comment once per issue and adds
possible-secret, without echoing the key
(tools/issueguard, self-tested on fake event payloads with generated keys). -
scripts/repo-settings.sh(maintainer-run, idempotent,--dry-run) enables
Discussions and sets the 20 repository topics;examples/(GitHub Actions,
pre-commit, Claude Code hook settings and a Go library example run on generated
fixtures in CI); the 1280x640 social previewdocs/media/social-preview.png,
rendered bytools/socialpreviewwith the share card fonts and renderer (reached
throughinternal/report/social, not library API) and drift-checked in CI. New CI jobscommunity,
docs-walkthroughandexamples;make community-check,make examples-testand
make docs-walkthrough. -
Fuzzing on pull requests (Story 4.13): a fuzz target for every v1.0 parser and
decoder, addingFuzzParseDiff(gitlog -p),FuzzInlineAllow
(tokenhound:allow),FuzzGlob(ignore globs),FuzzParseBaseline,
FuzzClaudeCodeHookandFuzzSessionEnd(hook stdin),FuzzSettings(Claude Code
settings edits) andFuzzServe(MCP request decoding). Every parser and decoder
target uses the sharedinternal/fuzzcheckassertions: no panic, AD-26 size, depth and entry limits, and
no warning, issue or message repeating 8 or more bytes of the input (AD-3). The
fuzz inventory test fails when a registered decoder or parse format has no target
and lists the Epic 5 parsers still pending (archives, image layers, importers,
custom detectors, Codex and Cursor adapters).scripts/fuzz.shgains--list,
--matrixand a one-target mode (make fuzz-list) that fails a targetgo test
cannot fuzz (build tag, wrong signature;make fuzz-selftest), and the CIfuzzjob becomes
thefuzz-shortmatrix: every target for 20 seconds in parallel, uploading any
crasher (still only when the repository is public or run by hand). Fuzzing found
one limit breach, now fixed: a surface key with invalid UTF-8 and a control
character could grow past the 256-byte key limit when its characters were replaced.
The MCP server now writes every JSON-RPC error response as a fixed line without
data: errors the SDK builds itself (an unknown method, a malformed request, an
unknown prompt or resource) used to echo the method name or a parameter. -
Release gates and post-publish install checks (Story 4.18).
.github/workflows/release-gates.ymlruns on release-please pull requests and fails
naming the gate, the measured value and the threshold unless every v1.0 gate passes:
the benchmark reproduced from a clean checkout withprecision_verified >= 0.95and
TokenHound recall at or above the gitleaks and TruffleHog union (pending until
benchmark/is in the repository), at least 85% coverage on each core package,
the OpenSSF Scorecard score (recorded only), the AD-3 leak test, the dash lint,
no-benchmark-tag, the reproducible build, and the golden inventory (every provider
pattern and surface has a golden;go test ./...passed on ubuntu, macos and
windows for the release commit). It uploadsgates-summary.json; making it a
required check is indocs/security-setup.md..github/workflows/post-publish.yml
runs after a release, daily as a retry and by hand: it installs exactly the release
from every v1.0 row of the newdocs/data/install-matrix.yamlon each listed runner
(npmnpx, PyPIuvxandpipx run, Homebrew, Scoop, Docker,go install, the
GitHub Action fromdist/github-actionat the release tag and thecosign verify-blob-checked download), runsversionand a
fixture history scan, marks a channel that has not caught uppending(never
passed), retries it daily for up to 7 days, and opens or updates arelease-blocker
issue and the job summary table. The logic is the newtools/gates
(run,evaluate,plan,report,fixture,check-version,check-scan)
with threshold edge tests; each install isscripts/post-publish-install.sh, with a
self-test on fake channel tools (scripts/post-publish-install-selftest.sh, in
make workflow-check).tools/covercorealso gatespkg/report,
internal/fixplan,internal/candidateandinternal/warnxand gains-json;
scripts/cover-library.shcan write its total (COVER_TOTAL_OUT); the dotenv
surface gets a golden (surfaces-project.golden);tools/workflowcheckallows
no write scope inrelease-gates.ymland onlyissues: writein
post-publish.yml. -
Generated and checked README (Story 4.16):
make readme-gen(tools/readmegen)
regenerates the badge row (a fixed list plusdocs/data/badges.yaml; a badge whose
status ispendingis not shown, so the OpenSSF Scorecard badge is hidden until its
first published score), the demo block, the surfaces table (one row per agent from
the surface registry, macOS paths, with a pointer to the other OSes), the providers table (verified when the registry has a verify
block, otherwise detected) and the install matrix, now generated from the new
docs/data/install-matrix.yaml(npm, PyPI, Homebrew, Scoop, Docker,go install,
the GitHub Action and release binaries, with platforms; every one is required).make readme-check, part of
make ciand the CIworkflow lintjob, fails on block drift, on a missing, extra
or moved README section (readme-order), on a quickstart that is not exactly the
three commands, on a prevention claim in "What it prevents and what it does not"
that the policy section ofdocs/hooks/policy.mddoes not list (or a policy limit
the README leaves out; fenced lines count), on any other README sentence that says
hooks block or prevent keys without the policy's "live and high-confidence keys", on a key-shaped string in the README or the demo tape output
log (AD-3), and on a demo GIF of 5 MB or more or longer than 15 seconds.
make link-check(tools/linkcheck) checks every relative link and#anchorin the
tracked Markdown files offline with GitHub's heading slug rules. -
Demo GIF setup for the maintainer: the VHS tape
docs/media/demo.tape,
scripts/demo-env.sh(a sandboxed HOME and project seeded from disposable keys in
DEMO_OPENAI_KEY,DEMO_ANTHROPIC_KEYand optionalDEMO_GROQ_KEY, printing no key;
exit 2 when a key is missing or the directory is inside a git work tree, and the
sandbox is deleted when the script fails) with a self-test on generated test keys
(make demo-env-selftest), and the recording checklist
docs/media/README-recording.md(revoke the keys right after recording and re-run to
confirm they are dead). Until the GIF is recorded the README keeps the synthetic
text output; oncedocs/media/demo.gifand its log exist, the README shows the GIF
with the final headline as alt text. -
Generic false positive rules (Story 4.21): the generic entropy detector no longer
reports bare hex of a sha224, sha384 or sha512 length, bare hex of an md5, sha1 or
sha256 length assigned to a name with a hash word (token_sha256), a UUID
assigned to a name with an id word (token_id), or a cut-short provider key: a
value starting with a registry prefix, shorter than that pattern allows, with only
the pattern's own characters after the prefix. Session, JWT and Datadog hex
secrets, UUID API keys and other keys that only share a prefix (Stripesk_live_,
sk-ant-oat01-,sk-None-, proxysk-keys) are still found. Provider detectors
are unchanged. Seedocs/detection.md. -
Launch artefacts (Story 4.17), drafts only, under
docs/launch/: the benchmark
write-up, "What your coding agent remembers" (tools/genremembers, generated from
the surface registry: files per OS, format, fields that can hold keys and the
registry note of every agent surface), the launch video shot list and recording
checklist, and post drafts for Show HN, X, LinkedIn, dev.to, emails to TLDR Sec,
TLDR AI, Latent Space and Changelog, and pull request texts for awesome-security,
awesome-devsecops, awesome-claude-code and MCP server lists.make launch-render
(tools/launchrender) renders them fromdocs/launch/templates/, where every
number is a placeholder read fromdocs/benchmark/results.json, the registry or
the share card (the video recording parameters intemplates/video.yamlare
readable only by the video script, and that file accepts only those keys), and
renders the share carddocs/launch/share-card.png(totals only, no repository
name, labelled "Demo scan, generated test keys"; its alt text, starting "Demo:",
is in every draft) from the demo fixture scan: the README demo sandbox seeded with
generated test keys and scanned by a benchmark build. Rendering exits 2 naming the
template whenresults.jsonno longer supports a comparison its prose states
(TokenHound's precision below TruffleHog's, more false alarms, recall at or above
the combined recall, an identical gitleaks tuned row).make launch-check, part
ofmake ciand the CIworkflow lintjob, fails on drift, on a literal number
in launch prose no placeholder produced (dates, versions, list numbering, code and
URLs excepted, except that a percentage, dollar amount or multiplier in code in a
post or the write-up still fails), on a block, prevent, stop, deny or protect
claim without the policy's "live and high-confidence keys" or an absolute claim
such as "stops every leak" (a negation counts only when it governs the verb), on a
key-shaped string, a dash, an emoji or other non-ASCII text, and on a draft that
does not lead with numbers, does not state the benchmark's bias in the paragraph
of its first cited result or the next one, lacks the share card alt text, or
names an event or a launch date. The README hook-claims and leak checks moved to
tools/mdcheck, shared bytools/readmegenandtools/launchrender, with a
stricter split: a numbered list item is now its own unit, as bulleted items were,
so a claim in one is reported on its own line. -
Benchmark republished at a new seed (Story 4.21): the agent leak benchmark ran
again on 2026-11-19 at seed 20261119, which the generic rules were never tested
against, with TokenHound pinned to the commit carrying them. TokenHound
precision rose from 93.15% to 96.41% (false alarms 77 to 39) with recall still
100%; the README block anddocs/benchmark/results.jsonare synced, METHOD.md
records both seeds, and the 2026-11-18 run stays published. -
v1.0 adoption suite and the v1.0.0 cut (Story 4.19).
e2e/adoption/(build tag
e2e,make e2e-adoption, the new CIe2e-adoptionjob on ubuntu and Windows,
plus macOS once the repository is public) has one end-to-end test per v1.0
adoption-blocker promise of the PRD: verification by default, confidence,
.tokenhound-ignore, inlinetokenhound:allow, baseline and--new-only; staged
files, full history on all branches,--since, notebooks and agent surfaces;
verification only to registry verify hosts with read-only requests, rate limits,
zero network calls with--no-verifyand no full key in any output; the fix plan;
SARIF, JSON and GitHub annotations; the Claude Code pre-tool and session-end hooks,
the MCP server and the agent skill; the GitHub Action, pre-commit, Husky and
lefthook; the badge and share card; and an egress recorder (a strict CONNECT proxy)
that sees only the issuing provider's verify host and nothing from offline commands
or the hook with verification off. The tests drive the built binary (a benchmark
build answers live keys from ground truth) or the public library, on generated
keys, and a failure names its row and promise. The release gates' e2e jobs run the
suite on the release commit on all three operating systems.
docs/release/v1-checklist.mdlinks every PRD adoption blocker and NFR1 to NFR10
to its test, gate job or file and its latest passing run, with the Epic 5 rows
markedv1.xand their closing story;tools/checklistcheck(make checklist-check, inmake ciand the CIworkflow lintjob) fails when a row has
no evidence, a cited test, job or file does not exist (a test counts only with the
go test signature in a file some build compiles), a blocker row cites an adoption
test of another blocker, or an adoption test is cited by no row. Release notes now hold the CHANGELOG section, the benchmark table from
docs/benchmark/results.json(benchsync -notes), thecosign verify-blob,
sha256sumandcosign verifycommands, the install matrix
(readmegen -install-table -version X.Y.Z, which pins the Action row to the release being cut) and the registry contributor credits
(changelogrelease notes -repo), and the release job fails before publishing notes
when any of them is missing.docs/releasing.mdgains "Cutting v1.0.0" and
"Rollback". The evidence reference resolver oftools/threatmodelcheckmoved to
tools/internal/evidence, shared with the checklist check. -
Agent and account token patterns (Story 4.25), registry snapshot
2026.11.26:
Anthropicoauth-token(Claude Codesk-ant-oat01-tokens fromclaude setup-token,
usually inCLAUDE_CODE_OAUTH_TOKEN) andsession-key(claude.aisk-ant-sid01-
session keys), and OpenAInone-key(sk-None-keys with theT3BlbkFJmarker).
All three arehighconfidence provider findings with a provider fix plan, so the
Claude Code hook blocks them with verification off; before, only the generic
detector found them. Their lengths are not documented, so the Anthropic patterns
take a wide length range and match a longer token whole. The OpenAI key is verified
and priced like every OpenAI key; the two Anthropic patterns are detect only (no
documented read-only endpoint accepts the OAuth token, and a session key is never
replayed) and unpriced (no metered API billing). Their fix plans point to claude.ai
Settings: revoke the OAuth token under Claude Code (or in the Claude Console
organization that created it), and log out of all devices under Account for a
session key. The hook message suggests$CLAUDE_CODE_OAUTH_TOKENfor an OAuth token
and no variable for a session key. The provider schema gains patterndetect_only
(which excludes a patternverifyblock),unpricedand a patternfixblock
(revoke_url,revoke_note,replace_note,usage_url,env_vars); the Report
gainsdetectors.<id>.revoke_url,env_varandno_env_var, used by the SARIF
rule help. Seedocs/detection.mdanddocs/spend.md. -
--verifyturns verification on for one run, oververify: falsein a config file
andTOKENHOUND_VERIFY=false(Story 4.26). With--no-verifyit is a usage error. -
TOKENHOUND_HOOK_MISSING=allowlets a git hook whosetokenhoundis not onPATH
through with a warning (see below).
Fixed
CLAUDE_CONFIG_DIRis honoured wherever TokenHound looks for Claude Code's user
configuration (Story 4.26), as Claude Code resolves it:~/.claude/<rest>becomes
$CLAUDE_CONFIG_DIR/<rest>and~/.claude.jsonbecomes
$CLAUDE_CONFIG_DIR/.claude.json.hook install --claude-codeand
hook uninstall --claude-codechange$CLAUDE_CONFIG_DIR/settings.jsonand name
that path in their output; the session-end scan reads the moved settings,
.claude.jsonand transcripts;tokenhound,scan,agentsand the other
machine scans read the moved files too, located as$CLAUDE_CONFIG_DIR/...when the
directory is outside home (~/...when it is inside). A relative
CLAUDE_CONFIG_DIR, or one that exists but is not a readable directory, makes
hook installandhook uninstallexit 2 naming it; scans read~/.claudethen
and warn (surface_parse_failed, locationCLAUDE_CONFIG_DIR, detail
config_dir_relative; the session-end scan prints and records
config_dir_relative). Before, the hook went to~/.claude/settings.json, which
Claude Code never read.
Changed
-
The tap-publish job pushes the Homebrew cask and the Scoop manifest over SSH with
one write deploy key per repository (HOMEBREW_TAP_DEPLOY_KEY,
SCOOP_BUCKET_DEPLOY_KEYin thetap-publishenvironment) instead of fine-grained
personal access tokens (Story 4.28).scripts/tap-publish.sh pushwrites the key
with umask 077 to the job's temp directory, removes it on exit, masks it in git's
output, and runs ssh with only that key, no agent and strict host key checking
against GitHub's host keys pinned inscripts/github-known-hosts; a changed host
key fails with a message to update that file. The HTTPS token path stays as the
fallback when no deploy key is set.tools/workflowcheckconfines the deploy key
names to thetap-publishjob like the token names, anddocs/releasing.md
explains creating the keys withgh repo deploy-key add --allow-writeand
gh secret set --env tap-publish, and rotating them. -
Each translated README says the English README may be more up to date, for
example in the benchmark results and install commands. -
The six npm platform packages move to the
@tokenhoundorganization scope
(Story 4.27):@tokenhound/darwin-arm64,@tokenhound/darwin-x64,
@tokenhound/linux-arm64,@tokenhound/linux-x64,@tokenhound/win32-arm64and
@tokenhound/win32-x64, the esbuild layout. Claiming six unscoped
tokenhound-<os>-<arch>names in a minute tripped npm's spam detection. The main
package is stilltokenhoundand the command is stillnpx tokenhound; the
launcher resolves only the scoped names, andbuild.mjs,publish.mjs(including
bootstrap, which publishes each missing name once with--access public), the
npm install e2e anddocs/releasing.mduse them.docs/releasing.mdadds creating
the free npm organizationtokenhoundfirst, lists the seven packages to configure
for trusted publishing, and gives thenpm deprecatecommands for the four unscoped
0.0.0placeholders published before the stop. -
The managed git pre-commit and pre-push hooks fail closed (Story 4.26). The script
runstokenhoundfromPATH, else the binary that ranhook install(its absolute
path is recorded, so GUI git clients with a shortPATHkeep working); when neither
is found it blocks the commit or push with two lines naming the fix (install
TokenHound, orgit commit --no-verify/git push --no-verifyto skip once)
instead of printing "scan skipped" and letting it through.
TOKENHOUND_HOOK_MISSING=allowlets it through with a warning instead. The marker
is now# tokenhound-managed v2; a v1 hook from an earlier release is still
recognised, andtokenhound hook install --pre-commit(or--pre-push) replaces it
in place and says the earlier hook let commits through. -
After a scan with verification off, the
Next:line says why and ends with the
scan again with--verify, so the pasted command runs in any shell:
Next: verification was off; to check which keys are live run: tokenhound scan . --verify.
report --fromnamestokenhound scan --verify. -
The headline of a scan whose keys are all dead says where they are, by the source:
still in history(a commit),staged(only staged changes, as with
scan --staged),in the working tree(a repository's files), elsefound. It
saidstill in historyfor every dead key. -
Dependabot opens one pull request a week for every ecosystem (Go modules, GitHub
Actions, npm, pip and the Docker base image) through a multi-ecosystem group,
instead of one per ecosystem. -
scripts/repo-settings.shalso allows GitHub Actions to create pull requests (the
default token stays read): release-please needs it to open the release pull
request, and the first Release run onmainfailed without it. -
The README is rewritten for a first-time visitor (Story 4.24), in the order: the
one-line value, the demo, Quickstart, what you get (Find, Prove, Prevent, Fix), why
not just ask your agent, the benchmark, what it scans, install, CI and hooks,
privacy and safety, contributing. Pipeline stages and package boundaries move to
the docs linked from Contributing;readme-orderencodes the new order. -
The README benchmark block (
tools/benchsync, also the release notes-notes) is
in plain language: a headline of how many of the planted keys each tool found, one
row per tool at its default config with keys found (as "N of M (P%)"), keys missed
and false alarms (no precision, recall or F1 column, so a quiet tool that misses
most keys does not look best; no repeated tuned rows, no row or internal id for a
tool not run yet), what the numbers mean, a "Where others do better" line
generated from the data that puts a fewer-alarms win next to the keys that tool
found, and the by-construction bias. The technical table stays in
the benchmark'sRESULTS.md. The coding-agent baseline table uses the same columns. -
Prevention claims match their mechanism: only the Claude Code hook blocks live and
high-confidence keys; git hooks and the GitHub Action fail onfail_on, live keys
by default (addnot-verified,unknownandrate-limitedtofail_on.status
for unverified keys). The hook-claims check (tools/mdcheck, used by
readme-checkandlaunch-check) is now an allowlist checked clause by clause
(code spans left out, table rows split into cells, a ", and" clause split off only
when it names another mechanism): a blocking claim must say "live and
high-confidence keys" and name the Claude Code hook. A claim for git hooks,
commits, pushes, pull requests, husky, lefthook, the Action, CI or generic "hooks"
fails, and the message says to use fail wording. -
The README and translated Quickstarts install the Claude Code hook with
--command "npx tokenhound", so the hook works for an npx user with no
tokenhoundon PATH.readme-checkalso checks every hand-written "N providers
that support it" against the registry's verified provider count. -
The agent leak benchmark moved into this repository (Story 4.22):
benchmark/,
imported with its history (git subtree), is its own Go module
(github.com/aiagentpro/tokenhound/benchmark), so the product module gains no
dependency. It builds TokenHound andtools/testkeysfrom the same checkout: the
commit pinned inbenchmark/tools.lock(tokenhound.commit, in the history of
HEAD) is exported withgit archiveand built there, so the private-module setup
(GOPRIVATE, theTOKENHOUND_READ_TOKENCI secret, the module checksum rule in
tools.lock) is gone. The published 2026-11-18 results are unchanged and
make -C benchmark reproducestill matches them exactly. Its CI runs as the
benchmark-*jobs ofci.yml(unit tests and self-scan, the small-seed bench, the
fake-agent baseline pipeline, reproduce, the corpus hash on every OS), which
tools/workflowcheckrequires to check out the full history; it also rejects the
old token,GOPRIVATEand model provider keys in any workflow.make bench-sync
readsbenchmark/results/by default, the README benchmark links are relative
(benchmark/results/<date>/RESULTS.md,benchmark/METHOD.md),make bench-test
(inmake ci) andmake bench-reproducedelegate tobenchmark/, and
benchmark/build/is gitignored at the root. See
docs/adr/0007-benchmark-in-repo.md. -
README: the install table moved into the generated
install-matrixblock,
"What it prevents and what it does not" now lists the hook's limits as the policy
does, and every other block or prevent claim says "live and high-confidence keys". -
The distribution channel sources moved from
packaging/todist/(npm, PyPI, Scoop,
the GitHub Action). GoReleaser now writes its build output tobin/release/. -
The GitHub Action is used by path from this repository,
uses: aiagentpro/tokenhound/dist/github-action@vX.Y.Z(or a commit SHA), instead of
a separateaiagentpro/tokenhound-actionrepository. There is no moving@v1tag
and no Marketplace listing. Its self-test moved from the nested
dist/github-action/.github/workflows/test.ymlto theaction-selftestjob of
.github/workflows/ci.yml(uses: ./dist/github-action), andcommunitycheck
requires the example workflow to pin the path to a release tag or a commit SHA. -
The public Go packages moved under
pkg/: the library is now imported as
github.com/aiagentpro/tokenhound/pkg/tokenhound(still packagetokenhound), and
model,reportandconfigaspkg/model,pkg/reportandpkg/config. No Go
file sits at the module root. The CLI, the JSON Report and exit codes are unchanged.
Seedocs/adr/0006-repository-layout.md. -
The GitHub Action source moved to
packaging/github-action/, the release-please
files to.github/, andRELEASING.mdtodocs/releasing.md. -
The README is a landing page with install, Action, hooks, MCP and skill setup; the
full CLI reference moved todocs/cli.mdand the configuration reference to
docs/configuration.md. README translations in Simplified Chinese, Japanese,
Korean, Spanish, Brazilian Portuguese, German and French are indocs/i18n/, with a
docs index (docs/README.md) and.github/SUPPORT.md. -
The
ghaformat writes at most 10 annotations per level (GitHub's per-step limit)
in Report order; when it leaves lines out, it ends with one
::notice title=TokenHound::<N> more annotations not shown ...notice. Every
finding stays in SARIF and JSON. -
tokenhound hook install|uninstall --pre-commit|--pre-pushinstalls git hooks that
runtokenhound scan --stagedbefore each commit andtokenhound scan --pre-push
before each push. Single owner: the hook is written to the repository's hooks
directory (the common dir in a linked worktree) only when no manager owns the hooks;
with Husky, lefthook, the pre-commit framework or anycore.hooksPath, nothing is
written and the manager's snippet is printed. An existing hook is chained through
<hook>.tokenhound-chainedand restored byte for byte on uninstall. Without
tokenhoundonPATHthe hook prints one line and exits 0. Seedocs/hooks/. -
scan --pre-pushscans only the commits being pushed, from git's pre-push lines on
standard input orPRE_COMMIT_FROM_REF/PRE_COMMIT_TO_REF; invalid input exits 2. -
.pre-commit-hooks.yamlwith thetokenhoundandtokenhound-pre-pushhooks. -
Library (additive):
HistoryOptions.Until(the tip commit) and
HistoryOptions.ExcludeRemotes(leave out commits reachable fromrefs/remotes/*).
Changed
-
--stagedonscan,baseline,fixandreportnow scans only the staged changes (plus
history with--historyor--since), not the working tree, and reads the index in
GIT_INDEX_FILEwhen git sets it for a hook. The baretokenhoundcommand is
unchanged. -
The terminal summary follows the EXPERIENCE.md layout: meta line, blank line, the
headline, rows andWhy/Nextsections indented two spaces and separated by blank
lines, dollars right-aligned, the partial-results banner first, and thousands
separators on every count and dollar figure. The clean headline names commits only
when history was scanned (No AI keys found in 4,812 files. Grade A.). Not-verified
rows always printUNVER(no moreNOT VERIFIEDin the summary).Next:is now one
runnable command from an ordered table:tokenhound fix <id>for the first live key,
the same scan rerun without--no-verifyfor unverified keys,tokenhound fix <id>
for a dead key (preferring one in commit history), elsetokenhound hook install.
The width comes fromCOLUMNS, else the terminal size.git_not_foundnow reads
git not found: .gitignore not applied.report.TerminalOptionsaddsRerun.
Thetokenhound fixheader uses the same status words (LIVE,DEAD,UNKNOWN,
RATE-LTD,UNVER), soNOT VERIFIEDis gone there too. A summary re-rendered by
tokenhound report --fromnames a plaintokenhound scanas its rerun, since
rerunningreport --fromwould verify nothing. -
The
FixStepshape changed from{kind, text, url, command}to the fix plan shape
above, and the library type aliastokenhound.FixPlanwas renamed
tokenhound.FixPlanResult(the nameFixPlanis now the function). -
dollars_methodin the Report now listsformula,tier,tier_source,assumed,
limit_per_min,limit_source,limit_unit,unit_price_usd,price_unit_size,
model,cap_usd_per_dayandspend_as_of. -
The detect winner rule now ranks provider detectors before the generic detector,
then keyword context, computed confidence and id. Keyword context also counts on
the line before and after a match. -
The registry's YAML parsing, schema validation and
file:line: field: message
issues moved tointernal/yamlschema, shared with the config loader; registry
output is unchanged. -
The Finding and Report model moved to the public
modelpackage; the root
package re-exports every identifier with type aliases, so existing code compiles
unchanged. New lint rules keepmodela leaf and keep internal packages off the
root package. -
Grading (
internal/grade, adapterdefault, replacingminimal): per target, first
match wins, F for a live key when the summed livedollars_at_risk_per_day(integer
cents) reachesgrade.f_threshold_usd_per_day(default 500, from config through
GradeOptions) or the target is public, D for any live key, C for an unverified
high-confidence key, B for any other finding, A for none; suppressed findings and
unknownvisibility never count as live or public. Every target grade and the
overallgrade_reasonscarry strings of the formcode: ASCII sentencewith the
codeslive_over_threshold,live_public,live_key,
unverified_high_confidence,other_findingandclean. -
Terminal summary rewritten as a pure function of the Report and
report.TerminalOptions: meta line, headline sentence (2 live keys, $3,100 a day at risk, grade D), ranked rows with dollars,Why <G>:reasons, oneNext:line from an
ordered rule table, and the clean, only-dead, offline, rate-limited, partial-results,
git-not-found and skipped-files wording.scangains--all;--plainand--quiet
now shape the summary; colour, width and the stderrscanning...progress line are
decided in the CLI from the TTY,NO_COLOR,TERM,COLUMNS,--no-colorandCI. -
Report
metagains the optionalverification(onoroff),history_scanned
andcommits_scannedfields (additive, indocs/schema/report.v1.json);
Results.Progress()returns the files and commits scanned so far. -
Surface registry and source (snapshot
2026.11.13.4):registry/schema/surface.json,
registry/surfaces/withclaude-codeandclaude-code-transcripts,
Registry.Surfaces()andRegistry.Surface(id), structure-aware parsers forjson,
jsonc,jsonl,toml,yaml,inianddotenvwith field selectors
(permissions.allow[],env.*,mcpServers.*.env.*,**leaves) and real line
numbers, and thesurfacesource adapter (engine.SourceSurface, scopesmachine
andproject): per-OS path resolution, root-confined project files, streamed jsonl
transcripts and one chunk per entry with asurfaceLocation (surface_id,path,
line,field) so two-part credentials in one MCPenvblock pair. New warning code
surface_parse_failed(detailsparse_error,unsupported_format). No CLI flag or
command uses it yet; seedocs/surfaces.md.make leak-testnow also covers a surface
scan. -
The CI and
make self-scanself-scan now reads the full git history
(--history), not only the working tree. -
tokenhound versionfrom ago installbuild prints the module version without
the leadingv(1.2.3, notv1.2.3), like every other channel.
Added
- Git scanning:
tokenhound scan --history,--since <ref>and--stagedthrough
internal/gitx, the only package that runsgit(hardened flags and environment,
validated refs, streamedgit log -pwith post-image line numbers). Findings get
commit or staged locations, andfirst_seen(earliest commit, author, date) and
age_daysrelative tometa.generated_at. Library:tokenhound.History,
tokenhound.Staged,Options.IncludeIgnored,Options.Now. Seedocs/git.md. - Inside a git work tree a plain scan now reads what git would commit (tracked plus
untracked files that are not ignored) and skips ignored trees;--include-ignored
restores the full walk. New warning codegit_not_foundwhen a repository is walked
without git. A new lint rule keepsexec.Commandout of everything butinternal/gitx
andscripts. - Core agent surfaces and the
agentscommand: surface entriescodex,codex-auth,
codex-transcripts,cursor,cursor-settings,shell-history-bash,-zsh,-fish,
-powershell,dotenvandnpmrc; a tolerantshell-historyparser for bash, zsh
(extended), fish and PowerShell files;tokenhound agents(an "Agents checked" table of
every machine surface as found, not installed or unreadable, then the usual summary);
baretokenhoundnow scans the machine surfaces plus, inside a git repo, the project
surfaces and the working tree (history only with--history), and outside a repo prints
Not in a git repo: scanned this machine's agent surfaces only.;
tokenhound providers --surfaces. The Report gains the optionalsurfaces_checked[] {surface_id, status}(additive, schema version 1). Library:tokenhound.MachineSurfaces()
andtokenhound.ProjectSurfaces(root),Report.SurfacesChecked,
report.TerminalOptions.NotScanned. Behaviour changes: a dotenv file skips lines that are
notKEY=valueand gives onesurface_parse_failedwarning with the new detail
partial_parseinstead of being rejected whole; the project walk skipsnode_modules,
stops after 200000 entries (walk_limit) and a project scan rooted at the home directory
is skipped; a surface path that is a symlink or other non-regular file is reported
unreadablewith afile_unreadablewarning (not_regular_file); a.envread by both
the working tree and the dotenv surface is one location of kindsurface.tested_version
values are from vendor docs and unconfirmed. Seedocs/surfaces.md. - Claude Desktop, VS Code MCP, Gemini CLI (settings and
.env), Windsurf and Jupyter surfaces
(claude-desktop,vscode-mcp,gemini-cli,gemini-cli-env,windsurf,jupyter,
jupyter-config) and theipynbparse format: surface entries using it are no longer skipped
withunsupported_format. A notebook checkpoint (**/.ipynb_checkpoints/*.ipynb) is read one
line per value with the cell source and text outputs, and each Location carries the 1-based
celland the line within the cell (kind stayssurface). A corrupt notebook gives one
surface_parse_failedwarning. New fuzz targetFuzzParseIPYNB.tested_versionvalues are
from vendor docs and unconfirmed. Seedocs/surfaces.md. - Notebook source: a
.ipynbfile reached by the working tree walk is read with one shared
nbformat reader and emitted as one chunk per cell source and per cell outputs, each with a
notebookLocation (path, 1-basedcell,linewithin the cell source or the cell
outputs). A key split across lines inside one cell behaves as in a plain text file. A corrupt
notebook falls back to a raw text scan with one newnotebook_parse_failedwarning (detail
parse_error). The reader is streaming: image and other non-textdatapayloads,metadata
andattachmentsare never retained,limits.max_file_bytesapplies to the retained text
(the raw.ipynbmay be up to 8 times larger; beyond that, or beyond the text limit, one
file_too_largewarning), and ANSI escape sequences are stripped from outputs, in the
jupytersurface too. A notebook location and a surface location at the same cell and line
collapse into the surface one. New fuzz targetFuzzReadNotebook. A notebook with several
non-empty cells counts as several files inmeta.files_scanned. Seedocs/surfaces.md. - Binary, oversize, partial and deterministic scans (Story 1.23). Files with a NUL byte in
their first 8 KiB (working tree and surface files; not stdin, git history or staged lines, and
not.ipynb) are skipped without a warning and counted in the new optional Report field
meta.binary_skipped(additive, schema version 1; also shown in the terminal meta line). The
binary check runs before the size check, so a huge image is a quiet skip. Decision: a file over
limits.max_file_bytesis still skipped withfile_too_large(no scan of a prefix, because a
key cut at the boundary would be wrong or missed silently); withCI=true,fail_on.warnings
now defaults to[timeout, file_too_large]and a projecttokenhound.yamlcannot drop either
(ADR 0002). Surface statuses gainnot_visited: a scan stopped by a timeout or cancel no longer
reports unvisited agents asnot_installed(agentsprints "not visited"). Surface walks of
one run share one 200000-entry budget, one source reads at most 64 times
limits.max_file_bytesof surface files (newsurface_parse_faileddetailbudget), and each
surface file is read once per run, deduped by resolved path. A corpus test over a generated
repository (working tree, stdin, history, staged, machine and project surfaces, notebooks)
proves the--deterministicJSON Report is byte-identical across runs, worker counts, source
order and OSes, againstinternal/engine/testdata/determinism/report.golden.json
(.gitattributesnever converts it). Newmake cover-core(tools/covercore,COVER_MIN,
default 85) and a CIcoveragejob fail when a core package is below 85% statement coverage.
Library:tokenhound.SurfaceNotVisited,Meta.BinarySkipped. Seedocs/adr/0002,README.md
anddocs/surfaces.md. - Suppression with
.tokenhound-ignoreand inlinetokenhound:allow(grammar in
docs/schema/ignore.v1.md). Ignore rulespath:<glob>(with**),loc:<path>:<line>,
id:th_<16 hex>anddetector:<id>,#comments, CRLF and a BOM accepted; paths are
relative to the ignore file and matched case-sensitively against Location paths. The
project file is<root>/.tokenhound-ignoreorignore_file(a configured file that is
missing exits 2; the default being absent is silent; a project file resolving outside the
root through a symlink exits 2);<user config dir>/tokenhound/ignoreholds rules for
machine locations. A malformed line exits 2 with<file>:<line>: <message>, never
echoing the rule.tokenhound:allow(any finding) ortokenhound:allow th_<id>on the
match line or the line above suppresses that location, in working tree files, stdin,
staged and history diffs, notebook cells and surfaces.id:,detector:and the test
marker suppress the whole finding;path:,loc:and inline markers only when every
location is covered, so a key also in an unignored file stays active and is verified.
Candidates whose first location is covered wait for the end of detection before verify,
so ignored keys are never verified.suppression_reasonis the closed enumignore_id,
ignore_detector,ignore_path,ignore_loc,inline_allow,test_marker,
imported_allowlist(first wins), now inreport.v1.json. Library:
Options.Ignore,IgnoreRule,IgnoreKind,IgnoreScope, theReason*constants,
SuppressionReasons(),ErrInvalidIgnoreRule;config.LoadfillsOptions.Ignore.
Breaking: the generated test key reasontest_keyis nowtest_marker, and the
terminal count line is<n> suppressed (see --format json). - Baselines:
tokenhound baseline [path](terminalandjsonformats) scans like
scanwith verification off, never reads an existing baseline and writes the
unsuppressed findings to.tokenhound-baseline.jsonat the scan root or thebaseline
config path (docs/schema/baseline.v1.json:schema_version,tool_version,
registry_snapshot,findings[{id, provider, detector, redacted}]sorted by id; no
status, locations or timestamps; mode 0600), printingWrote <n> findings to <path>or
{"path", "count"}. Scans read the baseline and the suppress stage sets
new_vs_baselineon every unsuppressed finding from its final id (absent without a
baseline and on suppressed findings); baselined findings are still verified and graded.
scan --new-onlyand the bare command's--new-only, user-tiernew_onlyand
TOKENHOUND_NEW_ONLYleave baselined findings out offail_on, with the terminal line
<n> baselined findings not counted for failure (--new-only); a project-tier
new_only: trueis ignored (untrusted_config_key,gate_loosening). Without a baseline
file,--new-onlyadds the new warning codebaseline_missingand every finding counts.
An invalid or newer baseline exits 2 with<file>: <field>: <message>; a project or
default baseline path that leads outside the root through a symlink exits 2. Library:
Options.Baseline,Baseline,BaselineFinding,BaselineSchemaVersion,
FailOn.NewOnly,CodeBaselineMissing,ErrInvalidBaseline;config.Loadfills
Options.Baseline(skip withInput.SkipBaseline),config.BaselinePathand
config.Flags.NewOnly;report.TerminalOptions.NewOnly. tokenhound report [path|-] [--from <report.json>]: re-renders a saved Report
(--from <file|->, validated againstdocs/schema/report.v1.json; no scan and no
network call) or a new scan of path with the scan flags and--new-only, in any
registered format, and exits byfail_onon the Report (0 or 1; 2 for usage and
input errors). Without--formatit writes the JSON Report to-o(default
./tokenhound.json, mode 0600) and printsWrote <file>. Output routing is shared
withscan,agentsand the bare command: one format goes to stdout or-o <file>,
several need-o <dir>and are written under each format's file name
(tokenhound.json; terminal goes to stdout), and the summary goes to stderr when
stdout carries no terminal output, unless--quiet. A binary format alone with no
-oand a terminal stdout exits 2. The report package gains a format registry:
report.Lookupandreport.FormatInfo(name,-o <dir>file name, binary), and
report.Formats()andRenderread it.sarif(tokenhound.sarif),gha
(tokenhound.gha.txt, with--new-onlypassed through),card
(tokenhound.png, binary) andbadge(tokenhound.svg) are registered, so they now
work onscan,agents,reportand the bare command;reportalso takes
--card-label, and a card bound for a terminal exits 2 with
PNG output needs -o <dir> or a redirect. Every JSON golden in the repository is validated
againstreport.v1.jsonorbaseline.v1.json(tests/schema).
Benchmark
Of 1,047 AI keys hidden in agent files, repository files, git history, encoded values and notebooks, TokenHound found 1,047, gitleaks 825 and TruffleHog 440.
| Tool | Keys found | Keys missed | False alarms |
|---|---|---|---|
| TokenHound | 1,047 of 1,047 (100%) | 0 | 39 |
| gitleaks | 825 of 1,047 (79%) | 222 | 203 |
| TruffleHog | 440 of 1,047 (42%) | 607 | 8 |
The test keys are generated from TokenHound's own patterns, which favours TokenHound at finding them; read the method before comparing.
Each row is a tool at its default config: the tuned gitleaks and TruffleHog configs found no extra keys, so they get no rows of their own. Not compared yet: GitHub secret scanning.
What these numbers mean:
- Keys found: of the 1,047 keys planted, how many the tool reported. A missed key is a leak you never hear about, so this is the number that matters most.
- False alarm: an alert on something that was not a key (the test also holds 1,175 look-alike decoys). A false alarm costs you a moment to check and dismiss.
Where others do better: TruffleHog raises fewer false alarms (8 against TokenHound's 39), but it found only 440 of the 1,047 keys (42%).
TokenHound's live or dead check gave the right answer for 534 of the 534 keys it checked (against the benchmark's stand-in for the provider APIs, not real providers).
Run on 2026-11-19 with the open agent leak benchmark against TokenHound commit b6aa45ed4bc9, seed 20261119. Full technical results, with precision and recall per category, the tuned configs and every place TokenHound scores lower: RESULTS.md; summary: summary.json; data: https://github.com/aiagentpro/tokenhound/blob/v1.0.0/docs/benchmark/results.json.
Verify this release
Download checksums.txt, checksums.txt.sigstore.json and the archives you want, then check the signature and the digests:
cosign verify-blob --bundle checksums.txt.sigstore.json --certificate-identity https://github.com/aiagentpro/tokenhound/.github/workflows/release.yml@refs/heads/main --certificate-oidc-issuer https://token.actions.githubusercontent.com checksums.txt
sha256sum --ignore-missing -c checksums.txt(shasum -a 256 --ignore-missing -c checksums.txt on macOS.) Every archive has an SPDX JSON SBOM named <archive>.spdx.json, also listed in checksums.txt. The container image is signed too:
cosign verify ghcr.io/aiagentpro/tokenhound:1.0.0 --certificate-identity https://github.com/aiagentpro/tokenhound/.github/workflows/release.yml@refs/heads/main --certificate-oidc-issuer https://token.actions.githubusercontent.comInstall
| Channel | Command | Platforms |
|---|---|---|
| npm (no install) | npx tokenhound |
macOS, Linux and Windows; amd64 and arm64 |
| PyPI | uvx tokenhound, pipx run tokenhound or pip install tokenhound |
macOS, Linux and Windows; amd64 and arm64 |
| Homebrew | brew install aiagentpro/tap/tokenhound |
macOS and Linux; amd64 and arm64 |
| Scoop | scoop bucket add aiagentpro https://github.com/aiagentpro/scoop-bucket then scoop install tokenhound |
Windows; amd64 and arm64 |
| Docker | docker run --rm -v "$PWD:/src" ghcr.io/aiagentpro/tokenhound scan /src |
Linux; amd64 and arm64 |
| Go | go install github.com/aiagentpro/tokenhound/cmd/tokenhound@latest |
macOS, Linux and Windows; amd64 and arm64 |
| GitHub Action | uses: aiagentpro/tokenhound/dist/github-action@v1.0.0 |
macOS, Linux and Windows; amd64 and arm64 |
| Binaries | Releases, with checksums.txt and its cosign bundle |
macOS, Linux and Windows; amd64 and arm64 |
Contributors
Registry contributors
Thanks to everyone who improved the provider registry in this release: