feat(controller): redact secrets in log API responses#152
Open
OnlyTerp wants to merge 1 commit into
Open
Conversation
- Add controller/src/core/log-redaction.ts with conservative patterns for Authorization/Bearer headers, X-Api-Key, env-style API keys/tokens, JSON-ish secret pairs, CLI flag secrets, and URL query params. - Apply redaction only at GET /logs/:sessionId and /logs/:sessionId/stream output boundaries; preserve raw log files on disk. - Add tests/controller/integration/log-redaction.test.ts covering all patterns and a route-level check that raw files are unchanged. - No UI changes, no logger format rewrite, no metrics parsing changes.
This was referenced Jun 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
controller/src/core/log-redaction.tswith conservative patterns for bearer tokens, API keys, HF/OpenAI/Anthropic env tokens, generic*_API_KEY/*_TOKEN, JSON-ish secret pairs, CLI flag secrets, and URL query secrets.GET /logs/:sessionIdandGET /logs/:sessionId/streamresponse boundaries.Verification
bun test tests/controller/integration/log-redaction.test.ts— 14 pass, 0 failnpm --prefix controller run typechecknpm --prefix controller run lintKnown upstream check
npm run check:contractscurrently fails on currentmainwith duplicateAggregatedSessionexports infrontend/src/app/api/agent/sessions/all/route.tsandfrontend/src/features/agent/session-contracts.ts; this PR does not touch those files.Notes / Non-goals