Skip to content

Conversation

@westey-m
Copy link
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
@github-actions github-actions bot changed the title Redacting log data unless opting out. .NET: Redacting log data unless opting out. Nov 21, 2025
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

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

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants