Skip to content

.NET: Redacting log data unless opting out.#2372

Merged
westey-m merged 2 commits into
microsoft:mainfrom
westey-m:santize-log-data
Nov 21, 2025
Merged

.NET: Redacting log data unless opting out.#2372
westey-m merged 2 commits into
microsoft:mainfrom
westey-m:santize-log-data

Conversation

@westey-m

Copy link
Copy Markdown
Contributor

Motivation and Context

Description

Redacting log data unless opting out for memory components.

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 November 21, 2025 10:41
@markwallace-microsoft markwallace-microsoft added the .NET Usage: [Issues, PRs], Target: .Net label Nov 21, 2025
@github-actions github-actions Bot changed the title Redacting log data unless opting out. .NET: Redacting log data unless opting out. Nov 21, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements privacy-conscious logging by redacting sensitive data (user IDs, user messages, and memory content) from logs by default, requiring explicit opt-in via the EnableSensitiveTelemetryData option for memory components.

  • Added EnableSensitiveTelemetryData property to ChatHistoryMemoryProviderOptions and Mem0ProviderOptions (defaults to false)
  • Implemented SanitizeLogData method in both providers that redacts data to "<redacted>" unless opted in
  • Added comprehensive unit tests to verify logging behavior with and without sensitive telemetry enabled

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
dotnet/src/Microsoft.Agents.AI/Memory/ChatHistoryMemoryProviderOptions.cs Added EnableSensitiveTelemetryData property with XML documentation
dotnet/src/Microsoft.Agents.AI/Memory/ChatHistoryMemoryProvider.cs Implemented sensitive data sanitization in log statements using a private helper method
dotnet/src/Microsoft.Agents.AI.Mem0/Mem0ProviderOptions.cs Added EnableSensitiveTelemetryData property with XML documentation
dotnet/src/Microsoft.Agents.AI.Mem0/Mem0Provider.cs Implemented sensitive data sanitization in log statements using a private helper method
dotnet/tests/Microsoft.Agents.AI.UnitTests/Memory/ChatHistoryMemoryProviderTests.cs Added unit tests to verify redaction behavior for both InvokedAsync and InvokingAsync methods
dotnet/tests/Microsoft.Agents.AI.Mem0.UnitTests/Mem0ProviderTests.cs Added unit tests to verify redaction behavior for both InvokedAsync and InvokingAsync methods, updated existing test to explicitly enable telemetry

Comment thread dotnet/src/Microsoft.Agents.AI.Mem0/Mem0Provider.cs
@westey-m westey-m added this pull request to the merge queue Nov 21, 2025
Merged via the queue into microsoft:main with commit 7148718 Nov 21, 2025
14 checks passed
Comment thread dotnet/src/Microsoft.Agents.AI.Mem0/Mem0Provider.cs
arisng pushed a commit to arisng/agent-framework that referenced this pull request Feb 2, 2026
@westey-m westey-m deleted the santize-log-data branch February 25, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NET Usage: [Issues, PRs], Target: .Net

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants