fix: allow safe key type updates for non-admins - #35132
Conversation
6e50760 to
a70cb1e
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
43f8012 to
a14474c
Compare
Greptile SummaryThis PR allows non-admin key owners to apply safe key-type presets during key updates while preserving admin-only enforcement for management and arbitrary routes
Confidence Score: 5/5The PR appears safe to merge because preset-derived routes are validated against the non-admin allowlist before the same deterministic mapping is persisted Explicit arbitrary routes remain subject to the existing admin check, safe presets resolve to approved route groups, the management preset remains rejected for non-admin callers, and updates omitting key_type retain their prior partial-update behavior
|
| Filename | Overview |
|---|---|
| litellm/proxy/_types.py | Adds an optional key-type preset to partial key-update requests without changing requests that omit the field |
| litellm/proxy/management_endpoints/key_management_endpoints.py | Applies key-type presets consistently during validation and persistence while limiting non-admin callers to safe route groups |
| tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py | Covers successful non-admin safe-preset updates and rejection of the management preset |
| ui/litellm-dashboard/src/lib/http/schema.d.ts | Regenerates the dashboard API contract to expose the new optional update field |
Reviews (1): Last reviewed commit: "fix: align key update schema and lint" | Re-trigger Greptile
PR overviewAll previously flagged issues have been addressed. No open security concerns remain on this pull request. Security reviewNo open security issues remain on this pull request. Fixed/addressed: 2 · PR risk: 0/10 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0c7825e606
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 089e75a0f4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 58411baf36
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5b4e0b0353
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
TLDR
Problem this solves:
How it solves it:
Relevant issues
Fixes #34975
Linear ticket
Pre-Submission checklist
@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
At commit
0c7825e, the Proxy Auth & Key Management CI suite passed and Codecov confirmed that all modified, coverable lines are covered. The complete repository check set is green except the unrelated UI unit-test job, which GitHub cancelled rather than failed.Focused local result: 16 passed, 373 deselected.
Type
🐛 Bug Fix
Changes
key_typeto key update requestsQA runbook
TestAllowedRoutesCallerPermission::test_non_admin_update_key_accepts_empty_routes_with_safe_key_typeproves safe presets work for a key owner/key/updateas that user withallowed_routes: []and each ofdefault,llm_api, andread_onlyTestAllowedRoutesCallerPermission::test_non_admin_update_key_rejects_empty_routes_with_management_key_typeproves management access stays restricted/key/updateas the key owner withallowed_routes: []andkey_type: managementallowed_routesFinal Attestation