Skip to content

fix(langfuse): redact a whole list/dict under a secret-named key in sanitized mode - #449

Open
fredheathcote007 wants to merge 1 commit into
NousResearch:mainfrom
fredheathcote007:fix/langfuse-mask-structured-secret-fields
Open

fredheathcote007 wants to merge 1 commit into
NousResearch:mainfrom
fredheathcote007:fix/langfuse-mask-structured-secret-fields

Conversation

@fredheathcote007

Copy link
Copy Markdown

What

In sanitized capture 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. full mode is unchanged.

Tests

TestCaptureModes::test_sanitized_mode_masks_structured_secret_fields fails on main (the list exports raw) and passes with the fix. It also checks that non-secret keys and full mode are untouched.

The full langfuse suite passes (179 tests) and hermes plugins validate passes. Both were run on Linux with Python 3.14 against current hermes-agent main, using the install steps from tests.yml. I haven't run them on macOS or Windows locally; CI covers those.

🤖 Generated with Claude Code

…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant