-
Notifications
You must be signed in to change notification settings - Fork 934
.NET: Redacting log data unless opting out. #2372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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
EnableSensitiveTelemetryDataproperty toChatHistoryMemoryProviderOptionsandMem0ProviderOptions(defaults tofalse) - Implemented
SanitizeLogDatamethod 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 |
Motivation and Context
Description
Redacting log data unless opting out for memory components.
Contribution Checklist