feat: Add IResponseSanitizer seam for pluggable MCP response sanitization - #3777
Open
Garrett Beatty (GarrettBeatty) wants to merge 1 commit into
Open
feat: Add IResponseSanitizer seam for pluggable MCP response sanitization#3777Garrett Beatty (GarrettBeatty) wants to merge 1 commit into
Garrett Beatty (GarrettBeatty) wants to merge 1 commit into
Conversation
McpResponseSanitizer is sealed with no interface and McpGovernanceRuntime depends on the concrete type, so response sanitization cannot be replaced or extended. - Add IResponseSanitizer (ScanText) in AgentGovernance.Mcp; McpResponseSanitizer implements it (no behavior change). - McpGovernanceRuntime now depends on IResponseSanitizer. - WithGovernance registers the default behind the interface via TryAddSingleton, so a consumer can register their own IResponseSanitizer before WithGovernance and it wins. Adds tests for default resolution and custom replacement. Refs microsoft#3776
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
PR Review Summary
Verdict: AI review comments are untrusted advisory output. The summary reports workflow-generated completion status only, not model-authored pass/fail claims. |
Author
|
@microsoft-github-policy-service agree company="Amazon" |
Garrett Beatty (GarrettBeatty)
marked this pull request as ready for review
August 18, 2026 23:32
Garrett Beatty (GarrettBeatty)
requested review from
MohammadHaroonAbuomar and
liamcrumm
as code owners
August 18, 2026 23:32
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
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.
Draft implementation for #3776.
Problem
McpResponseSanitizerissealedwith no interface andMcpGovernanceRuntimedepends on the concrete type, so response sanitization can't be replaced or extended.Change
IResponseSanitizer(ScanText) inAgentGovernance.Mcp;McpResponseSanitizerimplements it (no behavior change).McpGovernanceRuntimedepends onIResponseSanitizer.WithGovernanceregisters the default behind the interface viaTryAddSingleton, so a consumer can register their ownIResponseSanitizerbeforeWithGovernanceand it wins.Tests
Adds coverage for default resolution and custom replacement. All existing MCP tests pass (82 total).
Draft: opening to align on the API shape (interface surface, optional composition of multiple sanitizers) before finalizing. Happy to iterate.