Skip to content

.NET: Update AIContextProviders to use Microsoft.Extensions.Compliance.Redaction#4854

Open
westey-m wants to merge 4 commits intomicrosoft:mainfrom
westey-m:use-m.e.compliance.redaction
Open

.NET: Update AIContextProviders to use Microsoft.Extensions.Compliance.Redaction#4854
westey-m wants to merge 4 commits intomicrosoft:mainfrom
westey-m:use-m.e.compliance.redaction

Conversation

@westey-m
Copy link
Contributor

Motivation and Context

Addressing SDK review feedback.

#2375

Description

  • For places where we redact sensitive data from logs, allow users to provider their own redactor implementations by allowing a Redactor from Microsoft.Extensions.Compliance.Redaction to be supplied.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings March 23, 2026 12:35
@markwallace-microsoft markwallace-microsoft added documentation Improvements or additions to documentation .NET labels Mar 23, 2026
@github-actions github-actions bot changed the title Update AIContextProviders to use Microsoft.Extensions.Compliance.Redaction .NET: Update AIContextProviders to use Microsoft.Extensions.Compliance.Redaction Mar 23, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates .NET AI context providers’ logging redaction to use Microsoft.Extensions.Compliance.Redaction.Redactor, allowing callers to supply a custom redactor while keeping an explicit EnableSensitiveTelemetryData override for unredacted logs.

Changes:

  • Add Redactor + EnableSensitiveTelemetryData options to multiple providers and route log payloads through the configured redactor.
  • Introduce a shared internal ReplacingRedactor (default placeholder "<redacted>") and MSBuild injection support (InjectSharedRedaction).
  • Expand unit tests to validate default vs custom redaction behavior and precedence rules.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
dotnet/src/Microsoft.Agents.AI/Memory/ChatHistoryMemoryProviderOptions.cs Adds Redactor option + precedence remarks.
dotnet/src/Microsoft.Agents.AI/Memory/ChatHistoryMemoryProvider.cs Switches sanitization to a Redactor instance (default placeholder or caller-provided).
dotnet/tests/Microsoft.Agents.AI.UnitTests/Memory/ChatHistoryMemoryProviderTests.cs Updates tests for default/custom redaction and precedence.
dotnet/src/Microsoft.Agents.AI/TextSearchProviderOptions.cs Adds EnableSensitiveTelemetryData and Redactor options.
dotnet/src/Microsoft.Agents.AI/TextSearchProvider.cs Applies redaction to trace log payloads via a Redactor.
dotnet/tests/Microsoft.Agents.AI.UnitTests/Data/TextSearchProviderTests.cs Adds test coverage for redaction behavior.
dotnet/src/Microsoft.Agents.AI.Mem0/Mem0ProviderOptions.cs Adds Redactor option + precedence remarks.
dotnet/src/Microsoft.Agents.AI.Mem0/Mem0Provider.cs Switches sanitization to Redactor instance.
dotnet/tests/Microsoft.Agents.AI.Mem0.UnitTests/Mem0ProviderTests.cs Updates tests for default/custom redaction and precedence.
dotnet/src/Microsoft.Agents.AI.FoundryMemory/FoundryMemoryProviderOptions.cs Adds Redactor option + precedence remarks.
dotnet/src/Microsoft.Agents.AI.FoundryMemory/FoundryMemoryProvider.cs Switches sanitization to Redactor instance.
dotnet/src/Shared/Redaction/ReplacingRedactor.cs Adds shared internal placeholder redactor implementation.
dotnet/src/Shared/Redaction/README.md Documents shared redaction injection and package dependency.
dotnet/eng/MSBuild/Shared.props Adds InjectSharedRedaction injection hook.
dotnet/src/Microsoft.Agents.AI/Microsoft.Agents.AI.csproj Enables shared redaction injection + adds compliance abstractions package reference.
dotnet/src/Microsoft.Agents.AI.Mem0/Microsoft.Agents.AI.Mem0.csproj Enables shared redaction injection + adds compliance abstractions package reference.
dotnet/src/Microsoft.Agents.AI.FoundryMemory/Microsoft.Agents.AI.FoundryMemory.csproj Enables shared redaction injection + adds compliance abstractions package reference.
dotnet/Directory.Packages.props Pins Microsoft.Extensions.Compliance.Abstractions version.
dotnet/agent-framework-dotnet.slnx Adds shared redaction files as solution items.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation .NET

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants