Redact names ending in token or _secret, code_verifier, authorization and cookies #6

Merged
merge-queue merged 1 commit from redact-oauth-keys into main 2026-11-26 14:33:05 -08:00
Owner

Closes a masking gap in Redact across C, Go, Rust, C# and JS: AHT-204.

Added (two shapes, after the existing NAME=value one, in all five implementations):

  • Any name ending in token or _secret (refresh_token, access_token, id_token, session_token, bearer_token, accessToken, X-Auth-Token, other_secret...), code_verifier and authorization, as key=value, key: value, JSON "key": "value", single-quoted dict fields (Python, JS), and URL/form parameters. An Authorization scheme (Bearer, token, Basic) is kept before the mask. A value of digits alone ("page_token": 2, next_token=0) stays, and the value stops at , ; } so JSON numbers are judged correctly.
  • Cookie / Set-Cookie values: every cookie in the value, to the end of the line or the closing quote.

Unchanged: every existing shape and case. tokens=3, max_tokens, input_tokens, token_type, token_count, tokenizer, cookie_jar, cookies, client_secret_expires_at and prose about tokens are kept (cases in testdata/redact.json).

Not exempted: null/true/false after a token name are masked as *** (RE2 has no lookahead to exempt them; only digit-only values stay). Names ending in secret with no separator (sharedSecret), other than the existing secret and clientSecret, are not matched, per the _secret rule.

The C matchers m_key and m_cookie emulate the Go patterns' leftmost-first match; ci-check passed all 8 jobs (Go, Rust, C, C#, JS).

🤖 Generated with Claude Code

Closes a masking gap in `Redact` across C, Go, Rust, C# and JS: [AHT-204](https://openproject.home.romaine.life/wp/AHT-204). **Added** (two shapes, after the existing NAME=value one, in all five implementations): - Any name ending in `token` or `_secret` (`refresh_token`, `access_token`, `id_token`, `session_token`, `bearer_token`, `accessToken`, `X-Auth-Token`, `other_secret`...), `code_verifier` and `authorization`, as `key=value`, `key: value`, JSON `"key": "value"`, single-quoted dict fields (Python, JS), and URL/form parameters. An Authorization scheme (`Bearer`, `token`, `Basic`) is kept before the mask. A value of digits alone (`"page_token": 2`, `next_token=0`) stays, and the value stops at `, ; }` so JSON numbers are judged correctly. - `Cookie` / `Set-Cookie` values: every cookie in the value, to the end of the line or the closing quote. **Unchanged**: every existing shape and case. `tokens=3`, `max_tokens`, `input_tokens`, `token_type`, `token_count`, `tokenizer`, `cookie_jar`, `cookies`, `client_secret_expires_at` and prose about tokens are kept (cases in `testdata/redact.json`). **Not exempted**: `null`/`true`/`false` after a token name are masked as `***` (RE2 has no lookahead to exempt them; only digit-only values stay). Names ending in `secret` with no separator (`sharedSecret`), other than the existing `secret` and `clientSecret`, are not matched, per the `_secret` rule. The C matchers `m_key` and `m_cookie` emulate the Go patterns' leftmost-first match; `ci-check` passed all 8 jobs (Go, Rust, C, C#, JS). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Redact names ending in token or _secret, code_verifier, authorization, cookies (AHT-204)
All checks were successful
Suite release / reserve (pull_request) Has been skipped
Suite release / finalize (pull_request) Has been skipped
Suite release / dispatch (pull_request) Has been skipped
Suite release / deploy-image (pull_request) Has been skipped
Suite cmake / check-test-windows (pull_request) Successful in 1m11s
Suite release / check-build (none, ubuntu-latest) (ubuntu-latest, none) (pull_request) Has been skipped
Suite release / check-package (pull_request) Has been skipped
Suite release / build (none, ubuntu-latest) (ubuntu-latest, none) (pull_request) Has been skipped
Suite release / home-sync (pull_request) Has been skipped
Suite release / module (pull_request) Has been skipped
Suite web-app / check-image (pull_request) Has been skipped
Suite release / reused-checks (pull_request) Has been skipped
Suite release / publish (pull_request) Has been skipped
Suite web-app / publish (pull_request) Has been skipped
Suite web-app / publish-static (pull_request) Has been skipped
Suite rust / check-test-windows (pull_request) Successful in 1m6s
Suite default / reused-checks (pull_request) Successful in 16s
Suite rust / reused-checks (pull_request) Successful in 25s
Suite go / check-test-windows (pull_request) Successful in 1m1s
Suite default / check-rules (pull_request) Successful in 21s
Suite go / check-format (pull_request) Successful in 25s
Suite dotnet / check-test-windows (pull_request) Successful in 1m27s
Suite cmake / check-test-linux (pull_request) Successful in 26s
Suite rust / check-format (pull_request) Successful in 25s
merge-queue landed on main
Suite web-app / check-test (.) (pull_request) Successful in 32s
Suite dotnet / reused-checks (pull_request) Successful in 14s
Suite cmake / reused-checks (pull_request) Successful in 14s
Suite web-app / reused-checks (pull_request) Successful in 29s
Suite go / reused-checks (pull_request) Successful in 16s
9fceb1ee7e
Redact missed refresh_token=, access_token=, id_token= outside a URL and their
JSON fields, which auth and chess-tactics' session store can print. One new
shape masks any name ending in token or _secret, code_verifier and
authorization in every form the list covers (plus single-quoted dicts),
keeping an Authorization scheme and leaving digit-only values; another masks
Cookie and Set-Cookie values to the end of the line. C, Go, Rust, C# and JS
all run the new cases in testdata/redact.json.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
merge-queue deleted branch redact-oauth-keys 2026-11-26 14:33:06 -08:00
Sign in to join this conversation.
No reviewers
No labels
queue
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
romaine-life/logline!6
No description provided.