From 1e315dc33b13fdc17029305760fb4e9b3ff69972 Mon Sep 17 00:00:00 2001 From: aayush-malviya-acquia Date: Fri, 1 Aug 2025 11:11:18 +0530 Subject: [PATCH] Fix API Key Being Logged (#12978) * AIF-262 Fix for keys being logged * AIF-262 Undid http exception detail removal * AIF-262 Converted f-string to normal --- litellm/proxy/auth/user_api_key_auth.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/proxy/auth/user_api_key_auth.py b/litellm/proxy/auth/user_api_key_auth.py index fb70426bd5..31395fe7da 100644 --- a/litellm/proxy/auth/user_api_key_auth.py +++ b/litellm/proxy/auth/user_api_key_auth.py @@ -579,7 +579,7 @@ async def _user_api_key_auth_builder( # noqa: PLR0915 elif api_key == "": # missing 'Bearer ' prefix raise Exception( - f"Malformed API Key passed in. Ensure Key has `Bearer ` prefix. Passed in: {passed_in_key}" + "Malformed API Key passed in. Ensure Key has `Bearer ` prefix." ) if route == "/user/auth": @@ -1237,7 +1237,7 @@ def get_api_key_from_custom_header( api_key = _get_bearer_token(api_key=custom_api_key) verbose_proxy_logger.debug( "Found custom API key using header: {}, setting api_key={}".format( - custom_litellm_key_header_name, api_key + custom_litellm_key_header_name, abbreviate_api_key(api_key) ) ) else: