mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
fix: Return 403 exception when calling GET responses api (#17629)
This commit is contained in:
parent
05f800fe7d
commit
2d5a50804b
1 changed files with 6 additions and 5 deletions
|
|
@ -402,13 +402,14 @@ def _allowed_routes_check(user_route: str, allowed_routes: list) -> bool:
|
|||
- user_route: str - the route the user is trying to call
|
||||
- allowed_routes: List[str|LiteLLMRoutes] - the list of allowed routes for the user.
|
||||
"""
|
||||
from starlette.routing import compile_path
|
||||
|
||||
for allowed_route in allowed_routes:
|
||||
if (
|
||||
allowed_route in LiteLLMRoutes.__members__
|
||||
and user_route in LiteLLMRoutes[allowed_route].value
|
||||
):
|
||||
return True
|
||||
if allowed_route in LiteLLMRoutes.__members__:
|
||||
for template in LiteLLMRoutes[allowed_route].value:
|
||||
regex, _, _ = compile_path(template)
|
||||
if regex.match(user_route):
|
||||
return True
|
||||
elif allowed_route == user_route:
|
||||
return True
|
||||
return False
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue