fix(proxy): add /prompts/list to self_managed_routes (fixes 401 for internal_user)#24311
fix(proxy): add /prompts/list to self_managed_routes (fixes 401 for internal_user)#24311xykong wants to merge 1 commit intoBerriAI:mainfrom
Conversation
The prompts endpoint is defined as @router.get('/prompts/list') (plural)
but self_managed_routes only contained '/prompt/list' (singular), causing
401 Unauthorized errors for internal_user and other non-admin roles.
Fixes BerriAI#24307
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR fixes a one-character typo (
Confidence Score: 4/5
|
| Filename | Overview |
|---|---|
| litellm/proxy/_types.py | Adds "/prompts/list" to self_managed_routes, correctly fixing the 401 for non-admin users; introduces a minor incidental indentation inconsistency on the two surrounding lines. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Incoming Request\nGET /prompts/list] --> B{RouteChecks\n.check_route_access}
B -->|route in management_routes?| C[Allow - Admin Only]
B -->|route in self_managed_routes?| D[Allow - Endpoint Manages Own Auth]
B -->|neither| E[Require PROXY_ADMIN\n→ 401 for internal_user]
D --> F[prompt_endpoints.py\nhandles authorization]
style E fill:#f88,color:#000
style D fill:#8f8,color:#000
style F fill:#8f8,color:#000
Last reviewed commit: "fix(proxy): add /pro..."
| "/prompt/list", | ||
| "/prompt/info", | ||
| "/prompts/list", # plural route alias — endpoint is @router.get("/prompts/list") |
There was a problem hiding this comment.
Incidental indentation inconsistency
Lines 660 and 661 were modified to have an extra leading space (9 spaces) while all other entries in self_managed_routes use 8 spaces. This is an unintentional whitespace change that breaks the list's consistent formatting.
| "/prompt/list", | |
| "/prompt/info", | |
| "/prompts/list", # plural route alias — endpoint is @router.get("/prompts/list") | |
| "/prompt/list", | |
| "/prompt/info", | |
| "/prompts/list", # plural route alias — endpoint is @router.get("/prompts/list") |
| "/prompt/list", | ||
| "/prompt/info", |
There was a problem hiding this comment.
Potentially stale route entries
"/prompt/list" and "/prompt/info" (singular) appear in self_managed_routes, but no corresponding @router.get("/prompt/list") or @router.get("/prompt/info") endpoint exists anywhere in litellm/proxy/. These entries appear to be dead/stale and may have been pre-migration placeholders.
While this is pre-existing and not introduced by this PR, it's worth confirming whether these should be cleaned up or are intentionally kept for backward compatibility with an older routing scheme.
Summary
Fixes a one-character naming mismatch that causes
GET /prompts/listto return401 Unauthorizedforinternal_userand other non-admin roles.Fixes #24307
Root Cause
self_managed_routescontained"/prompt/list"(singular), but the actual endpoint is registered as@router.get("/prompts/list")(plural) inlitellm/proxy/prompts/prompt_endpoints.py.Because the route isn't in the whitelist, the proxy's permission checker requires
PROXY_ADMINfor any request to/prompts/list, causing a 401 for non-admin users.Change
Testing
internal_userAPI key can now successfully callGET /prompts/list/prompt/listentry preserved for backward compatibilityImpact
internal_user,team, any non-PROXY_ADMINrole