Add event-level redact_event hook, protect server/client identity fields - #50
Merged
naji247 merged 1 commit intoAug 7, 2026
Merged
Conversation
…ient identity fields Add an event-level redact_event hook (AgentCatOptions.redact_event), matching the redactEvent/RedactEvent hooks already available in the TypeScript and Go SDKs. It runs before redact_sensitive_information, receives the full event, and may return a modified event or None to drop it entirely. id, session_id, project_id, event_type, and timestamp are restored from the original event afterward regardless of what the hook returns. Also add server_name, server_version, client_name, and client_version to PROTECTED_FIELDS: these are system-reported MCP metadata, not user-supplied content, and should always reach the dashboard intact rather than passing through redact_sensitive_information.
kashishhora
approved these changes
Aug 7, 2026
naji247
enabled auto-merge (squash)
August 7, 2026 16:08
This was referenced Aug 7, 2026
Merged
3 tasks
spencerhcheng
added a commit
to rootlyhq/rootly-mcp-server
that referenced
this pull request
Aug 10, 2026
`redact_sensitive_information` receives one bare string at a time, so a credential passed as a tool argument arrives as `hunter2` with nothing to say it came from a field called `password`. The only way to catch that from a string would be an entropy heuristic, which would also match incident IDs and service slugs -- the over-redaction that caused the outage this scrubber was written for. AgentCat's `redact_event` hook receives the whole event, so the field name is visible. `scrub_event_arguments` walks `parameters` and reuses `is_credential_key`, the classifier the string scrubber already uses. Nested dicts and lists are walked; non-string values are left as they are. `response` and `error` stay with the string scrubber, since they are free text with no keys to read. The hook is offered only when the installed SDK accepts it. It landed after 2.0.1, and passing an unknown option raises TypeError, which maybe_enable_mcpcat_tracking catches by disabling telemetry outright -- so unconditional use would switch telemetry off for anyone on the current release. Detection reads the options dataclass fields. That makes this safe to merge before AgentCat cuts the tag: it is inert on 2.0.1 and starts working when the image picks up the release. Verified against both, installing the SDK from 2.0.1 and from the merge commit of agentcathq/agentcat-python-sdk#50.
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
redact_eventhook (AgentCatOptions.redact_event), matching theredactEvent/RedactEventhooks already available in the TypeScript and Go SDKs. It runs beforeredact_sensitive_information, receives the full event, and may return a modified event orNoneto drop it entirely.id,session_id,project_id,event_type, andtimestampare restored from the original event afterward regardless of what the hook returns.server_name,server_version,client_name, andclient_versiontoPROTECTED_FIELDS: these are system-reported MCP metadata, not user-supplied content, and should always reach the dashboard intact rather than passing throughredact_sensitive_information.Example
Test plan
redact_sensitive_information