fix(audit): redact camelCase toolResult and toolArguments in audit trail - #329
Open
Ayush7614 wants to merge 1 commit into
Open
fix(audit): redact camelCase toolResult and toolArguments in audit trail#329Ayush7614 wants to merge 1 commit into
Ayush7614 wants to merge 1 commit into
Conversation
Tool results and arguments were only redacted under snake_case tool_result/tool_arguments, but audit payloads also carry them as toolResult/toolArguments (direct MCP and computer tool calls). The normalized check fell through because the set lacked the stripped forms toolresult/toolarguments, so plaintext secrets leaked into audit_events.payload. Add the two missing normalized keys so both spellings are covered. Verified with redactAuditPayload unit probes: snake, camel, nested, and upper-case variants now all return [REDACTED].
Ayush7614
requested review from
MikeRyanDev,
davidmckayv,
guidovizoso and
tylerslaton
as code owners
September 2, 2026 08:42
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.
What this changes
Audit payloads were redacted only for snake_case
tool_result/tool_arguments, but callers also write them as camelCasetoolResult/toolArguments(MCP and computer tool calls). The sensitive-key set atserver/src/audit.ts:5-33contained both spellings for every other key (access_token+accesstoken,document_content+documentcontent, …) but missed the stripped formstoolresult/toolarguments.redactAuditPayload({toolResult: "secret"})fell through bothtoLowerCase()(toolresult) andnormalizedKey()(toolresult) — neither in the set — and was stored verbatim inaudit_events.payload. Nested payloads leaked the same way.This adds the two missing normalized keys so both spellings are covered:
Why it matters
audit_events.payloadis queryable by administrators and retained perAUDIT_RETENTION_DAYS. A vendor token, prompt, or document content that reaches the trail astoolResultwas stored in plaintext, violating the gateway's invariant that secrets never enter the transcript trail. The same gap lettoolArgumentscontaining credentials slip through wheretool_argumentswould have been redacted.Not urgent per row, but silent and wide: every MCP/computer tool call carries one of the two keys, and the leak is invisible until somebody queries the trail.
Proof
Inline probe against
redactAuditPayloadbefore/after:bun run typecheck·bun run lint·bun run format:checkall pass. No existing tests touchredactAuditPayloadcamelCase variants — this fills that gap without touching the read path.Checklist
Closes nothing yet — standalone hardening.