From 8934def3c7bdcc3b295c54b9a423fe2c96993e3a Mon Sep 17 00:00:00 2001 From: Rodrigo Brandao Date: Fri, 7 Aug 2026 11:10:28 -0700 Subject: [PATCH] Removing sensitive logging at info or error levels --- .../microsoft_agents/authentication/msal/msal_auth.py | 4 +--- .../microsoft_agents/hosting/core/_oauth/_oauth_flow.py | 7 ++----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/libraries/microsoft-agents-authentication-msal/microsoft_agents/authentication/msal/msal_auth.py b/libraries/microsoft-agents-authentication-msal/microsoft_agents/authentication/msal/msal_auth.py index 81619e58..2fc9f1c4 100644 --- a/libraries/microsoft-agents-authentication-msal/microsoft_agents/authentication/msal/msal_auth.py +++ b/libraries/microsoft-agents-authentication-msal/microsoft_agents/authentication/msal/msal_auth.py @@ -146,9 +146,7 @@ async def acquire_token_on_behalf_of( ) if "access_token" not in token: - logger.error( - f"Failed to acquire token on behalf of user: {user_assertion}" - ) + logger.error(f"Failed to acquire token on behalf of user.") raise ValueError( authentication_errors.FailedToAcquireToken.format(str(token)) ) diff --git a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/_oauth/_oauth_flow.py b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/_oauth/_oauth_flow.py index d886d40e..27ae4a96 100644 --- a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/_oauth/_oauth_flow.py +++ b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/_oauth/_oauth_flow.py @@ -126,7 +126,7 @@ async def get_user_token(self, magic_code: str | None = None) -> TokenResponse: magic_code=magic_code, ) if token_response: - logger.info("User token obtained successfully: %s", token_response) + logger.info("User token obtained successfully") self._flow_state.expiration = ( datetime.now(timezone.utc).timestamp() + self._default_flow_duration ) @@ -315,10 +315,7 @@ async def continue_flow(self, activity: Activity) -> _FlowResponse: self._flow_state.expiration = ( datetime.now(timezone.utc).timestamp() + self._default_flow_duration ) - logger.debug( - "OAuth flow completed successfully, got TokenResponse: %s", - token_response, - ) + logger.debug("OAuth flow completed successfully, got a token response.") return _FlowResponse( flow_state=self._flow_state.model_copy(),