fix(proxy_server.py): check if api key string before asserting it starts with sk-

This commit is contained in:
Krrish Dholakia 2024-01-26 20:06:57 -08:00
parent 5dfe54d20d
commit b1b582ffe2

View file

@ -243,6 +243,7 @@ async def user_api_key_auth(
response = await user_custom_auth(request=request, api_key=api_key)
return UserAPIKeyAuth.model_validate(response)
### LITELLM-DEFINED AUTH FUNCTION ###
if isinstance(api_key, str):
assert api_key.startswith("sk-") # prevent token hashes from being used
if master_key is None:
if isinstance(api_key, str):