Repository navigation
fix(agent-core): redact the value of a name/value pair whose name is a credential - #833
Merged
Merged
Conversation
…a credential
Credentials are often carried as name/value pairs, where the credential
name is a value rather than a key: Kubernetes env entries
({"name":"DB_PASSWORD","value":"…"}), ECS/AWS Name/Value, CloudFormation
ParameterKey/ParameterValue/ResolvedValue, and key/value tag lists. The
structured path only checked keys, so the value was exported. When an
object's name field holds a credential name, its value fields are now
written as <redacted>; the name and other members are kept.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…token-count names - OutputKey/OutputValue (CloudFormation stack outputs) join the pair fields. - A pair name for a token count, limit or tokenizer (max_tokens, gen_ai.usage.input_tokens, llm.token_count.prompt) is not a credential name, so its value is kept. - Restore the closing of the previous-output test that the rebase onto dev dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s a token-usage phrase The token-count exclusion matched anywhere in the normalized name, so TOKENIZER_API_KEY or secret_max_tokens was treated as a token count and its value kept. A pair name is now a credential name when it still is one with its token-usage phrases taken out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Taking the phrases out of the separator-free name let a plural borrow the next word's first letter (MAX_TOKEN_SECRET became "ecret"), so such a credential name kept its value. The name is now split into words (at separators and camelCase boundaries) and only whole token-usage words or word pairs are taken out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Credentials often travel as name/value pairs. In these pairs the credential name is a value, not a key:
{"name":"DB_PASSWORD","value":"…"}Name/ValueParameterKey/ParameterValue/ResolvedValueOutputKey/OutputValueKey/Valuelistsagent-core's structured redaction only checked member keys, so the value of such a pair was exported.
Now, when an object's pair-name field (
name,Name,key,Key,ParameterKey,OutputKey) holds a credential name, every pair-value field (value,Value,ParameterValue,ResolvedValue,OutputValue) in that object is written as fi-core's placeholder<redacted>. The name and other members are kept.max_tokens,gen_ai.usage.input_tokens,llm.token_count.prompt,completion_tokensand tokenizer names keep their values.This is part of TH-11639, the structured name/value rule only. Free-text pair shapes (YAML
- name:/value:lists, Python-repr dicts, escaped JSON inside log lines, other pair spellings) are follow-ups on that card.Tests
traceai_agent_core/test/privacy.test.cjs:Response: <json>text;discoverSecretslearns neither the value nor the placeholder.valueandValue.ResolvedValueis redacted withParameterValue, while a non-credential parameter keeps it.An internal pre-review (three lenses, two skeptics per finding) found three issues, all fixed in fa1e0ef:
OutputKey/OutputValueshape;Nothing was run locally (repo rule); CI runs these tests.
🤖 Generated with Claude Code