Repository navigation
fix(langfuse): redact a whole list/dict under a secret-named key in sanitized mode - #449
Open
fredheathcote007 wants to merge 1 commit into
Conversation
…anitized mode
The secret-field mask only replaced scalar values, so {"token": [...]} or
{"credentials": {"value": ...}} was recursed into instead. The inner values
sit under no secret-named key, so sanitized mode exported them unredacted.
Mask any non-empty value under a secret field name; None, bools and ""
still pass through, and full mode is unchanged.
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.
What
In
sanitizedcapture mode (the default), the secret-field mask replaces only scalar values. A list or dict under a secret-named key is recursed into instead. Its inner values sit under keys that are not secret-named, so they are exported unredacted:{"token": ["opaque-token-a", "opaque-token-b"], "credentials": {"user": "svc", "value": "opaque-token-a"}}On main this tool output reaches Langfuse with both token values intact. This closes a remaining gap in the masking work tracked in NousResearch/hermes-agent#67544 (done here in #74).
Fix
Any non-empty value under a secret field name is now masked, whatever its type.
None, booleans and""still pass through unchanged, as before.fullmode is unchanged.Tests
TestCaptureModes::test_sanitized_mode_masks_structured_secret_fieldsfails on main (the list exports raw) and passes with the fix. It also checks that non-secret keys andfullmode are untouched.The full langfuse suite passes (179 tests) and
hermes plugins validatepasses. Both were run on Linux with Python 3.14 against current hermes-agent main, using the install steps fromtests.yml. I haven't run them on macOS or Windows locally; CI covers those.🤖 Generated with Claude Code