Repository navigation
Conversation
…ed bracket and after invalid outer JSON A stray unclosed bracket before valid JSON, a mismatched closer, or a balanced but invalid outer value (such as a trailing NaN) kept the inner JSON objects from the structured scan, so a credential member inside them was only seen by the free-text rules. The scan now tries the inner pairs it already recorded (at most 32 per region, so it stays linear) and rewrites an object that parses, as it does a top-level one. TH-11639 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Closing for now. Review found that this version redacts less than dev in one shape: keeping the text after a rewritten inner object exposes a later credential that dev's free-text rule dropped. Fixing that statically turned into a second-pass design that has not converged and has not been executed. Next steps, tracked on TH-11639:
|
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
agent-core's embedded-JSON scan finds JSON inside free text (tool output, log lines) and redacts credential members structurally. Three shapes kept it from trying the inner JSON objects, so a credential member inside them was only seen by the free-text rules:
see [ {"api key":"…"};cfg { mode: [ {"api key":"…"} } tail;[{"password":"…"}, NaN].The free-text rules miss some credential names, for example a key with a space before the last word (
"api key") or a leading underscore ("_password"), so those values were exported.The scan now tries the inner bracket pairs it has already recorded for that region, and rewrites an object that parses the way it rewrites a top-level one. It tries at most 32 pairs per region, so it stays linear. Output for every input the old scan already handled is unchanged.
Part of TH-11639 (items 1 and 2 of the embedded-JSON follow-ups).
Tests
traceai_agent_core/test/privacy.test.cjs:redact(redact(x)) === redact(x));An internal pre-review used two lenses, with two skeptics per finding. It confirmed one gap, a mismatched closer that still hid the objects, which is fixed. Nothing was run locally (repo rule); CI runs these tests.
Please weigh
"access key":"…") is now exported. The member the rewrite targets is redacted either way."between the stray bracket and the object (see [ " {"api key":"…"}) still hides the object, because the scan reads its brackets as string content. It stays on TH-11639.🤖 Generated with Claude Code