Redact our own tokens, not just other people's
`openagents trace redact` is the command we tell people to run before sharing a
trace. It removed a Stripe key and left an OpenAgents one, then printed
`Nothing matched the redaction rules` — which reads as an all-clear, so the
trace gets shared.
`trace-store.ts` grew its own rule list, separate from `packages/atif`. Its
`api_key` rule covers third-party prefixes — `sk-`, `ghp_`, `github_pat_`,
`gho_`, `glpat-`, `xox*`, `AKIA`, `AIza` — and stops there. Nothing in the list
covered `oa_pat_`, `oa_token`, `oa_agent_`, `oa-x-`, or `smct_`. A token was
caught only when it happened to sit under a key matching `secret_field`, or in
a `SHOUTING_CASE=` assignment. In prose or argv it passed straight through.
Verified before the fix, against the built CLI:
$ openagents trace redact probe.jsonl
Nothing matched the redaction rules.
$ cat probe.redacted.jsonl
…oa_pat_REALTOKEN456 oa_agent_ABCDEF123456 oa-x-QQQQ1234 smct_machine-secret…
and after:
Redacted 5 matches: api_key 1, oa_agent_token 1, x_code 1, oa_token 1, machine_token 1
…[REDACTED:oa_token] [REDACTED:oa_agent_token] [REDACTED:x_code] [REDACTED:machine_token]…
`smct_` machine tokens were missing from **both** lists, so they also survived
an ATIF export — the export path was not as covered as it looked. They carry a
hyphen, which every other token rule stops at.
The four new cases are added to the planted-secret table, which asserts the
token *body* is absent rather than that a marker appeared: a marker check
passes for a prefix swap that leaves the secret in place, which is a defect
this repo has shipped before. Checked by deleting the new rules — all four fail
— and restoring them.
The two rule lists still exist separately and will drift again. Folding
`trace-store.ts` onto the atif rules is the real fix and is not in this change.
Closes openagents#97.
Redact our own tokens, not just other people's
Deploy story
What this commit did to the running system — joined from the forge receipt chain, the part a commit page elsewhere cannot show.
Not deployed through the forge lane
No push, promotion, build, or deploy receipt references this commit (receipts are scanned over a bounded recent window). Changes shipped by full node replacement carry their proof in the release gate receipt instead.
Changed files
-
modified
packages/atif/src/redaction.test.ts -
modified
packages/atif/src/redaction.ts -
modified
packages/openagents-cli/src/trace-store.ts -
modified
packages/openagents-cli/test/trace-store.test.ts
Diff
4 files changed, +69 -0
packages/atif/src/redaction.test.ts modified +8
@@ -71,6 +71,14 @@ const SECRET_FIXTURES: ReadonlyArray<{
| 71 | 71 |
|
| 72 | 72 |
|
| 73 | 73 |
|
| 74 |
|
|
| 75 |
|
|
| 76 |
|
|
| 77 |
|
|
| 78 |
|
|
| 79 |
|
|
| 80 |
|
|
| 81 |
|
|
| 74 | 82 |
|
| 75 | 83 |
|
| 76 | 84 |
|
packages/atif/src/redaction.ts modified +8
@@ -11,6 +11,7 @@ export type RedactionCategory =
| 11 | 11 |
|
| 12 | 12 |
|
| 13 | 13 |
|
| 14 |
|
|
| 14 | 15 |
|
| 15 | 16 |
|
| 16 | 17 |
|
@@ -267,6 +268,13 @@ const RULES: ReadonlyArray<Rule> = [
| 267 | 268 |
|
| 268 | 269 |
|
| 269 | 270 |
|
| 271 |
|
|
| 272 |
|
|
| 273 |
|
|
| 274 |
|
|
| 275 |
|
|
| 276 |
|
|
| 277 |
|
|
| 270 | 278 |
|
| 271 | 279 |
|
| 272 | 280 |
|
packages/openagents-cli/src/trace-store.ts modified +27
@@ -406,6 +406,33 @@ export const redactionRules = (home: string): ReadonlyArray<RedactionRule> => [
| 406 | 406 |
|
| 407 | 407 |
|
| 408 | 408 |
|
| 409 |
|
|
| 410 |
|
|
| 411 |
|
|
| 412 |
|
|
| 413 |
|
|
| 414 |
|
|
| 415 |
|
|
| 416 |
|
|
| 417 |
|
|
| 418 |
|
|
| 419 |
|
|
| 420 |
|
|
| 421 |
|
|
| 422 |
|
|
| 423 |
|
|
| 424 |
|
|
| 425 |
|
|
| 426 |
|
|
| 427 |
|
|
| 428 |
|
|
| 429 |
|
|
| 430 |
|
|
| 431 |
|
|
| 432 |
|
|
| 433 |
|
|
| 434 |
|
|
| 435 |
|
|
| 409 | 436 |
|
| 410 | 437 |
|
| 411 | 438 |
|
packages/openagents-cli/test/trace-store.test.ts modified +26
@@ -249,6 +249,32 @@ describe("trace redaction", () => {
| 249 | 249 |
|
| 250 | 250 |
|
| 251 | 251 |
|
| 252 |
|
|
| 253 |
|
|
| 254 |
|
|
| 255 |
|
|
| 256 |
|
|
| 257 |
|
|
| 258 |
|
|
| 259 |
|
|
| 260 |
|
|
| 261 |
|
|
| 262 |
|
|
| 263 |
|
|
| 264 |
|
|
| 265 |
|
|
| 266 |
|
|
| 267 |
|
|
| 268 |
|
|
| 269 |
|
|
| 270 |
|
|
| 271 |
|
|
| 272 |
|
|
| 273 |
|
|
| 274 |
|
|
| 275 |
|
|
| 276 |
|
|
| 277 |
|
|
| 252 | 278 |
|
| 253 | 279 |
|
| 254 | 280 |
|