- A receipt shows that redaction ran and the log was not edited later. It cannot show a credential is absent from a response, only that the matchers found nothing in what the allowlist let through.
- The field allowlist applies to successful responses. Error bodies (4xx and 5xx) skip it and get redaction alone.
- The reveal token sits in the broker’s process environment, which any process of the same user can read on Linux. The threat model lists this as a known, unfixed weak spot.
- The agent runs as the same user as the broker and could edit its config file, so the per-machine credential list guards against accidents only.
- Side channels such as timing are out of scope, as is anyone with root or debugger access. It serves one operator on one workstation, over stdio or loopback only.
secret-broker lets coding agents use credentials without receiving them
An agent that holds an API key can print it, write it into a file, or be talked into sending it somewhere by text it reads on a web page (prompt injection). secret-broker is a local MCP server (Model Context Protocol, the standard way agents call tools) that makes the credential-backed call itself and hands the agent the cleaned-up result. Every call writes a receipt to a log that shows if it has been edited.
The agent asks for an operation and the broker holds the key
Only one tool can return a credential: a reveal for key rotation, which needs two gates the operator sets, and it has never been used. Otherwise the agent asks for a named operation, and the broker makes the request and returns the filtered response.
| Tool | The agent supplies | The broker supplies |
|---|---|---|
secret.call, secret.mutate | a service name and the request | the host, credential and response fields to keep, from the operator’s config |
secret.gh_api | a GitHub API path | the GitHub token |
secret.inject_env | a program from an approved list and the credential names it needs | the values, in that program’s environment; its output is scrubbed |
secret.reveal_credential | a token and a written reason | the raw value, only when two operator-set gates are open |
The agent names a service and cannot pass a URL. If the caller could choose the host, a prompt injection could choose where the credential is sent.
How a response is filtered and recorded
Field allowlistruns first
Each operation declares the top-level JSON fields it uses, and the rest of the response is dropped before any other step sees it, including debug fields that might repeat the authorization header. A non-JSON response is refused when an allowlist is set.
Three redaction layersexact, pattern, entropy
Layer 1 removes exact copies of every credential the broker has fetched, including encoded and JSON-escaped forms. Layer 2 matches a per-credential pattern to catch same-shape keys the broker never issued. Layer 3 removes any token of 32 or more characters with Shannon entropy (a measure of how random its characters are) of at least 4.5 bits per character.
Redaction on parsed valuescloses escape leaks
A credential with one character written as a JSON escape, such as \u0041 for A, slips past a text search and reappears once the JSON is parsed. The broker parses the body first and scrubs each decoded string value.
Hash-chained receiptsSQLite
Every call, including one refused before it runs, appends a row to a local SQLite log: operation, credential name, outcome and a redaction count, with no values or response bodies. Each row’s hash covers the previous row’s hash, so editing an old row breaks every hash after it. secret-broker audit verify recomputes the chain.
Two-gate revealfor key rotation
Rotating a key sometimes needs the raw value. reveal_credential returns it only when the supplied token matches one set in the broker’s launch environment and a one-shot flag file for that credential exists, which is deleted on use. Every attempt writes a receipt marked as a bypass.
What six months of receipts show
From 18 May to 3 November 2026 the broker wrote 2,568 receipts, and secret-broker audit verify
reported the chain intact. None is marked as a bypass, so the reveal path was never used.
| Operation | Receipts | Succeeded |
|---|---|---|
| Run a program with credentials in its environment | 1,165 | 900 |
| Cloudflare API | 585 | 433 |
| git credential helper (supplies git’s password) | 382 | 254 |
| LLM, web search and other configured services | 276 | 215 |
| GitHub API | 131 | 112 |
| Create, rotate or declare a credential | 29 | 23 |
| Total | 2,568 | 1,937 |
1,937 calls (75.4%) succeeded and 631 failed. Receipts store the kind of failure without the error message.
The broker could not complete the call252
128 came from the git credential helper between 15 and 29 July, the only two weeks with any helper receipts; the cause is not recorded. 84 were refused before running, for example a program missing from the approved list. Of the 40 that failed while running, 27 were programs that hit a timeout of 60 seconds or more.
The upstream API returned an error status230
Mostly 404 (107) and 403 (57), then 400 (26) and 401 (12); 151 came from the Cloudflare API. Twelve are May and June receipts where an early version logged a program’s non-zero exit under this label.
A program run with credentials exited with an error149
127 of these exited with code 1.
341 receipts (13.3%) record a scrubbed token, 217 of them a Layer 3 hit. Receipts do not say whether a scrubbed token was a credential, so these are not counts of leaks prevented.
Measuring the entropy layer on the broker’s own credentials
Layer 3 is the only layer that needs neither the credential’s value nor a known pattern for it. In July both of its error types were measured.
- 566 false positives on one clean response. A GitHub listing of 30 commits (269 KB) with no credential in it triggered Layer 3 566 times, mostly on PGP signatures and URLs. Those tokens scored 4.503 to 5.426 bits per character.
- 5 of 13 credential tokens caught (38%). A script run through
inject_envprinted only the length and entropy of 13 tokens from the broker’s own vault. They scored 3.501 to 5.357 bits per character. - 8 of the 13 scored below every false positive. The two ranges overlap, so no threshold separates credentials from noise.
- The proposed fix lost two credential shapes. Splitting tokens on
/and.cut false positives from 566 to 306 and stopped catching 2 of the 5 credential shapes in the test set, so it was dropped.
The fix shipped on 7 August keeps the thresholds. Layer 3 now skips a value
only when the whole value is a plain absolute URL, with no query string, fragment or
user:password@ part, or an armored block whose BEGIN and END labels match. On a
384 KB commits listing with no credential in it, Layer 3 hits fell from 592 to 52 (91.2%).
Tests pin the 4.5 and 32 thresholds and check that three credential shapes are still caught.
The accepted cost: an unissued credential wrapped in fake armor or shaped like a URL path (a Slack webhook, for example) now passes Layer 3. Layer 1 still removes any issued credential, whatever its wrapping. The change reduces noise and leaves the 5-of-13 catch rate unchanged, so for unissued credentials the design leans on the field allowlist, which drops a field without having to recognise its contents.
What the broker does not prove
All 1,007 tests pass, and mypy --strict and ruff report no issues.
Questions about the design? Email [email protected] · Back to portfolio