From 39c1e86e9525b1ac4f32a570139711659c7e6aff Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Sun, 6 Sep 2026 22:19:23 +0200 Subject: [PATCH] chore: keep OAuth token payloads out of logs (#29709) Two OAuth failure paths interpolated the raw token object into their log message. On the callback path that object is a live credential set, so a provider returning no user data wrote an access token, and usually a refresh token, straight into the application log. Both messages now log without the payload. The token-exchange failure keeps its error level and its client_id binding and reports the provider's error description instead of the raw response body, which by that branch's own condition never contained an access token anyway. The callback failure keeps its warning level and identifies the provider, matching the other failure logs in that handler. --- backend/open_webui/utils/oauth.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/open_webui/utils/oauth.py b/backend/open_webui/utils/oauth.py index 96505a6be0..81cdec4267 100644 --- a/backend/open_webui/utils/oauth.py +++ b/backend/open_webui/utils/oauth.py @@ -1263,7 +1263,7 @@ class OAuthClientManager: if token and not token.get('access_token'): error_desc = token.get('error_description', token.get('error', 'Unknown error')) error_message = f'Token exchange failed: {error_desc}' - log.error(f'Invalid token response for client_id {client_id}: {token}') + log.error('Invalid token response for client_id %s: %s', client_id, error_desc) token = None if token: @@ -1917,7 +1917,7 @@ class OAuthManager: if provider == 'feishu' and isinstance(user_data, dict) and 'data' in user_data: user_data = user_data['data'] if not user_data: - log.warning(f'OAuth callback failed, user data is missing: {token}') + log.warning('OAuth callback failed for provider %s, user data is missing', provider) raise HTTPException(400, detail=ERROR_MESSAGES.INVALID_CRED) # Extract the "sub" claim, using custom claim if configured