fix(key_generate): harden GHSA-q775 session-token exemption against default_key_generate_params#29640
Conversation
…efault_key_generate_params Capture _requested_team_id before the default_key_generate_params loop runs and key the UI/CLI session-token budget-ceiling exemption off it, instead of the post-defaults data.team_id. On an install that sets default_key_generate_params.team_id, a session token requesting a personal key (no explicit team_id) would otherwise have data.team_id auto-filled, flipping is_ui_session_team_key on and bypassing the delegated-authority ceiling -- the exact escalation GHSA-q775 closed. Mirrors the existing pre-defaults capture of _requested_max_budget. Adds a regression test. https://claude.ai/code/session_01RT583b1khYC3wjLrQ5hT5h (cherry picked from commit efeb101)
Greptile SummaryHardens the GHSA-q775 session-token exemption by capturing
Confidence Score: 5/5Safe to merge — the change is a two-line, surgically scoped fix that closes a narrow bypass in the budget ceiling check. The production change is a single pre-loop variable capture that directly mirrors an existing, identical pattern for No files require special attention.
|
| Filename | Overview |
|---|---|
| litellm/proxy/management_endpoints/key_management_endpoints.py | Captures _requested_team_id before the defaults loop, exactly mirroring the _requested_max_budget pattern; the is_ui_session_team_key exemption now keys off the pre-defaults value, closing the bypass. |
| tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py | Adds a focused regression test that patches litellm.default_key_generate_params with a team_id and asserts the budget ceiling still fires for a session-token personal-key request; all mocked, no real network calls. |
Reviews (1): Last reviewed commit: "fix(key_generate): harden GHSA-q775 sess..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Superceded by #29641 |
|
Closing in favor of #29641, which makes the same fix on Generated by Claude Code |
What & why
Canonical fix on the integration branch for a niche ceiling-bypass introduced by #29612.
#29612 added a UI/CLI session-token exemption to the GHSA-q775 delegated-authority budget ceiling, but it evaluates
data.team_idafter thedefault_key_generate_paramsdefaults loop can inject one. On an install that setsdefault_key_generate_params.team_id, a session token requesting a personal key (no explicitteam_id) hasdata.team_idauto-filled, flippingis_ui_session_team_keyon and skipping the ceiling — the exact escalation GHSA-q775 closed.Fix
_requested_team_id = data.team_idbefore the defaults loop (mirroring the existing pre-defaults capture of_requested_max_budget) and key the exemption off it.Note on target branch
#29612currently lives onlitellm_internal_staging(not yet onmain), so this PR targets staging — the fix promotes tomaintogether with #29612. The same hardening is applied to the release backports: #29635 (1.86.5), #29636 (1.87.2), and the 1.88 rc follow-up.Type
Bug Fix
Pre-Submission checklist
https://claude.ai/code/session_01RT583b1khYC3wjLrQ5hT5h
Generated by Claude Code