fix(key_generate): harden GHSA-q775 session-token exemption against default_key_generate_params (1.88 rc) - #29639
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 SummaryThis PR hardens the GHSA-q775 session-token exemption against
Confidence Score: 5/5Safe to merge — the change is a two-line pre-defaults capture that closes a narrow escalation path, and the regression test correctly exercises the exact bypass scenario. The production change is a single new variable capture placed precisely before the defaults loop, mirroring an identical pattern already present for No files require special attention.
|
| Filename | Overview |
|---|---|
| litellm/proxy/management_endpoints/key_management_endpoints.py | Adds pre-defaults capture of _requested_team_id and uses it in the is_ui_session_team_key guard — correct, minimal, and consistent with the existing _requested_max_budget pattern. |
| tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py | Adds a new regression test that accurately simulates a default_key_generate_params.team_id injection and verifies the budget ceiling is still enforced; test is mock-only, no real network calls. |
Reviews (1): Last reviewed commit: "fix(key_generate): harden GHSA-q775 sess..." | Re-trigger Greptile
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
What & why
Follow-up to the merged #29637 (which backported #29612 onto
patch/v1.88.0-rc.1). Closes a niche but real ceiling-bypass that #29612 introduced.#29612 added a UI/CLI session-token exemption to the GHSA-q775 delegated-authority budget ceiling, but it evaluated
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) would havedata.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....default_team_id_personal_key_still_capped) that fails on the pre-fix code and passes after.The same hardening is applied to the other release lines (#29635 / 1.86.5, #29636 / 1.87.2) and to the upstream integration branch.
Type
Bug Fix
Pre-Submission checklist