Skip to content

feat: mask sensitive keys in events - #14

Merged
naji247 merged 1 commit into
mainfrom
feat/mask-sensitive-keys
Nov 26, 2026
Merged

naji247 merged 1 commit into
mainfrom
feat/mask-sensitive-keys

Conversation

@naji247

@naji247 naji247 commented Nov 26, 2026

Copy link
Copy Markdown
Member

Summary

modules/pipeline/SensitiveKeys.java   new: port of the shared reference (vectors in src/test/resources/sensitive-keys-vectors.json)
modules/events/EventQueue.java
  processEvent
    applyRedactEvent, applyStringRedaction    (customer redaction hooks)
    sanitize
  + mask(ev, "parameters", ...), mask(ev, "response", ...)   -> SensitiveKeys.maskSensitiveKeys
    truncate
    sendWithRetry(buildRequest(...))

Every queued event goes through this one call site. If the mask fails on a field, that field becomes null, the SDK writes one writeToLog line, and the event goes out without the field. truncate and buildRequest keep their typed Map<String, Object> signatures.

Evidence

  • Before: HttpHeaderCaptureTest on origin/main asserts that the published event carries parameters.extra.http.req.headers.authorization = "Bearer secret-token".
    After: the published event carries "[redacted]" for authorization, cookie and x-api-key, keeps mcp-session-id, and the handler's transport context keeps the raw values (sensitiveHeadersAreMaskedAndTheHandlerKeepsThem). mvn --batch-mode --no-transfer-progress verify: 1187 tests, 0 failures, 0 errors, 0 skipped. The compat profiles mcp-1x and mcp-018x pass (14 tests each, 0 failures). mvn package -P release,mcp-2.0.1 -DskipTests -Dgpg.skip builds. The vectors test checks all 233 key cases and 17 tree cases.

Merge Danger

Door: two-way

Revert the commit to send the raw values again.

Blast Radius: all-customers

After the merge, the dashboard shows [redacted] for request headers such as authorization, cookie and x-api-key, and for tool arguments and results under key names such as pageToken, auth_type or password. Other headers and values do not change. No option turns the mask off.

Port the shared sensitive key mask to SensitiveKeys and call it in EventQueue
after the redaction hooks and the sanitizer, before truncation, on parameters and
response. Credential headers in parameters.extra.http.req.headers and other
sensitive keys now reach AgentCat as [redacted].
@naji247
naji247 merged commit 11d3634 into main Nov 26, 2026
14 checks passed
naji247 added a commit that referenced this pull request Nov 26, 2026
Version 1.1.2 has a dated section but was never published: the publish job of
its release run stopped when CI failed on a Maven download. The mask (#14)
merged after that, so a publish from main now ships 1.1.2 with the mask. The
entry moves from [Unreleased] into [1.1.2], and the 1.1.2 note about raw
Authorization and Cookie headers now says that the SDK masks them.
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.

2 participants