Fix spend logs v2 route permissions#28513
Conversation
Co-authored-by: ryan-crabbe-berri <ryan-crabbe-berri@users.noreply.github.com>
|
|
Greptile SummaryThis PR fixes a permission gap where
Confidence Score: 5/5Straightforward additive change that follows an established pattern; no existing behavior is modified. The change adds one enum member and two list entries, both directly parallel to the existing No files require special attention.
|
| Filename | Overview |
|---|---|
| litellm/proxy/_types.py | Adds /spend/logs/v2 to KeyManagementRoutes enum and registers it in both key_management_routes and spend_tracking_routes, mirroring the existing /spend/logs pattern exactly. |
| tests/test_litellm/proxy/auth/test_route_checks.py | Adds three focused mock-only regression tests for /spend/logs/v2 route classification and virtual-key access control, plus adds the route to ADMIN_VIEWER_LOGS_PAGE_ROUTES. |
Reviews (1): Last reviewed commit: "Fix spend logs v2 route permissions" | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Superseded by #28705 (same commits, branch renamed to |
Relevant issues
Reported issue:
/spend/logs/v2returns Unauthorized for virtual keys with Key Type = Management.Linear ticket
N/A
Pre-Submission checklist
tests/test_litellm/directory, Adding at least 1 test is a hard requirement - see detailsmake test-unit@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewDelays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
CI (LiteLLM team)
Branch creation CI run
Link:
CI run for the last commit
Link:
Merge / cherry-pick CI run
Links:
Screenshots / Proof of Fix
Type
🐛 Bug Fix
✅ Test
Changes
/spend/logs/v2to spend-tracking and key-management route inventories./spend/logs/v2and AI API virtual keys remain denied.Slack Thread