Skip to content

[#1181] agents-copilotstudio-client: Reduce privacy/security risk from logging full request bodies and activity - #1193

Merged
tracyboehrer (tracyboehrer) merged 6 commits into
mainfrom
southworks/fix/logging-privacy-risks
Aug 14, 2026
Merged

[#1181] agents-copilotstudio-client: Reduce privacy/security risk from logging full request bodies and activity#1193
tracyboehrer (tracyboehrer) merged 6 commits into
mainfrom
southworks/fix/logging-privacy-risks

Conversation

@ceciliaavila

Copy link
Copy Markdown
Collaborator

Fixes #1181

Description

This pull request introduces enhanced diagnostics and privacy controls for the Copilot Studio client by adding support for a diagnostics pseudonym key, improving redaction and pseudonymization of sensitive data, and updating observability and logging throughout the codebase. The changes ensure that conversation IDs and other potentially sensitive information are consistently pseudonymized or redacted in logs and telemetry, reducing the risk of exposing user data.

Diagnostics and Privacy Enhancements:

  • Added a new optional diagnosticsPseudonymKey property to ConnectionOptions and included it in environment-based settings loading (connectionSettings.ts). This key is used to pseudonymize conversation IDs across restarts for stable diagnostics without exposing real identifiers. [1] [2]
  • Updated the CopilotStudioClient and CopilotStudioWebChat classes to use the diagnosticsPseudonymKey for pseudonymizing conversation IDs in logs, diagnostics, and telemetry events. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]

Logging and Redaction Improvements:

  • Replaced direct logging of URLs, conversation IDs, and diagnostic objects with redacted or pseudonymized versions using new or updated utility functions (redactUrl, redactString, redactDiagnosticObject, pseudonymizeConversationId). [1] [2] [3] [4] [5]
  • Ensured that request and response bodies, as well as activity payloads, are redacted in logs when diagnostics are enabled. [1] [2] [3] [4] [5]

Telemetry and Observability Updates:

  • Refactored telemetry trace definitions to accept activity type and pseudonymized conversation ID instead of the full activity object, ensuring no sensitive data is sent to telemetry. [1] [2]
  • Updated metric reporting to avoid including conversation IDs in metrics labels, further reducing the risk of leaking sensitive data.

These changes collectively improve the privacy posture of the Copilot Studio client, while maintaining robust diagnostics and observability for troubleshooting and monitoring.

Testing

This image shows the redacted values and the pseudomyzed conversationId.
image

And these show the conversationId pseudonym after restarting the server.
image

Copilot AI review requested due to automatic review settings July 21, 2026 14:35
@ceciliaavila
Cecilia Avila (ceciliaavila) requested a review from a team as a code owner July 21, 2026 14:35

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 reduces privacy/security risk in @microsoft/agents-copilotstudio-client by pseudonymizing conversation IDs (optionally using a customer-supplied diagnostics key) and redacting sensitive fields before writing diagnostics logs and emitting telemetry/metrics.

Changes:

  • Added diagnosticsPseudonymKey support to connection settings (including env loading) and used it to pseudonymize conversation IDs in logs/telemetry.
  • Introduced redactDiagnosticObject + pseudonymizeConversationId utilities in @microsoft/agents-telemetry and applied them across client/webchat logging paths.
  • Refactored Copilot Studio trace/metric recording to avoid including conversation IDs in metric labels.

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
test-agents/copilotstudio-webchat/settings.js Exposes enableDiagnostics + diagnosticsPseudonymKey in sample webchat agent settings.
test-agents/copilotstudio-console/env.TEMPLATE Documents diagnosticsPseudonymKey for console sample env configuration.
packages/agents-telemetry/test/utils/redact.test.ts Adds unit coverage for diagnostic redaction + conversation ID pseudonymization behavior.
packages/agents-telemetry/src/utils/redact.ts Adds HMAC-based conversation ID pseudonymization and recursive diagnostic redaction helper.
packages/agents-telemetry/src/index.mts Exports new redaction/pseudonymization utilities from the ESM entrypoint.
packages/agents-telemetry/src/index.cts Exports new redaction/pseudonymization utilities from the CJS entrypoint.
packages/agents-telemetry/package.json Adds @noble/hashes dependency required for HMAC pseudonymization.
packages/agents-copilotstudio-client/src/powerPlatformEnvironment.ts Redacts URLs in debug logs for connection URL selection/generation.
packages/agents-copilotstudio-client/src/observability/traces.ts Refactors trace actions/records to accept activity type + pseudonymized conversation ID; removes conversation ID from metric labels.
packages/agents-copilotstudio-client/src/copilotStudioWebChat.ts Uses pseudonymized conversation IDs and redacted diagnostic objects when logging activities/events.
packages/agents-copilotstudio-client/src/copilotStudioConnectionSettings.ts Adds diagnosticsPseudonymKey to the public connection settings interface.
packages/agents-copilotstudio-client/src/copilotStudioClient.ts Applies URL redaction + diagnostic-object redaction and pseudonymized conversation IDs across request/activity/subscribe logs and traces.
packages/agents-copilotstudio-client/src/connectionSettings.ts Adds diagnosticsPseudonymKey to options and env-based settings loading (with redacted settings logging).
package-lock.json Locks @noble/hashes and updates dependency tree accordingly.

Comment thread packages/agents-copilotstudio-client/src/copilotStudioClient.ts
Comment thread packages/agents-copilotstudio-client/src/copilotStudioClient.ts
Comment thread packages/agents-copilotstudio-client/src/copilotStudioClient.ts
Comment thread packages/agents-copilotstudio-client/src/copilotStudioClient.ts
Comment thread packages/agents-telemetry/src/utils/redact.ts
Comment thread packages/agents-telemetry/src/utils/redact.ts
Comment thread packages/agents-telemetry/src/index.mts
# Conflicts:
#	packages/agents-copilotstudio-client/src/copilotStudioClient.ts
#	packages/agents-copilotstudio-client/src/copilotStudioWebChat.ts
#	packages/agents-copilotstudio-client/src/observability/traces.ts
@tracyboehrer
tracyboehrer (tracyboehrer) merged commit aa93859 into main Aug 14, 2026
6 checks passed
@tracyboehrer
tracyboehrer (tracyboehrer) deleted the southworks/fix/logging-privacy-risks branch August 14, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

agents-copilotstudio-client: Reduce privacy/security risk from logging full request bodies and activity

3 participants