Skip to content

chore(release): backport #29612 (session-token budget-ceiling exemption) into stable/1.87.x and cut 1.87.2#29636

Merged
mateo-berri merged 4 commits into
stable/1.87.xfrom
litellm_cherrypick_1_87_2
Jun 4, 2026
Merged

chore(release): backport #29612 (session-token budget-ceiling exemption) into stable/1.87.x and cut 1.87.2#29636
mateo-berri merged 4 commits into
stable/1.87.xfrom
litellm_cherrypick_1_87_2

Conversation

@mateo-berri

@mateo-berri mateo-berri commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Relevant issues

Backports #29612 (fixes #29073) onto the 1.87.x line, which already received the earlier batch (#29631). Cherry-picked from the squashed commit that landed on litellm_internal_staging (97ba7e1a30). Cuts 1.87.2

What is included

The last two commits are the version bump (1.87.1 → 1.87.2) and the matching uv.lock refresh

#29612 applies cleanly here: 1.87.x carries the GHSA-q775 delegated-authority budget ceiling (introduced by #27897) that this fix adds an exemption to. The cherry-pick is byte-identical to upstream (2 files changed, 93 insertions(+), no conflicts)

Note: this fix is intentionally NOT backported to 1.84.x or 1.85.x. Those lines predate the GHSA-q775 ceiling (#27897), so there is nothing to exempt — the bug #29612 fixes cannot occur there, and cherry-picking would insert code referencing an undefined _requested_max_budget

Pre-Submission checklist

  • The cherry-picked PR carries its own tests
  • My PR passes all unit tests on make test-unit
  • Scope is limited to backporting an already-merged fix plus the release bump

Type

Bug Fix
Infrastructure

Changes

See the commit list. No new code beyond the cherry-pick, the version bump, and the lockfile refresh

yuneng-berri and others added 3 commits June 4, 2026 00:06
…ng for team keys (#29612)

Non-admin users creating a team key through the UI were rejected with
"max_budget cannot exceed the caller's own max_budget (0.25)". The request is
authenticated by a UI/CLI session token whose max_budget is the per-session chat
spend cap (max_ui_session_budget, default $0.25), and the delegated-authority
budget ceiling (GHSA-q775-qw9r-2r4g) treated that cap as a delegation limit.

Skip the ceiling only when a session token creates a team key (data.team_id set);
that key's spend is bounded by the team budget at request time. Personal keys and
every other non-admin caller keep the ceiling, so a session token cannot mint an
arbitrary-budget personal key.

(cherry picked from commit 97ba7e1)
@mateo-berri mateo-berri marked this pull request as ready for review June 4, 2026 00:09
@mateo-berri mateo-berri requested review from a team and yuneng-berri June 4, 2026 00:09
@mateo-berri mateo-berri enabled auto-merge June 4, 2026 00:09
@codecov

codecov Bot commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...y/management_endpoints/key_management_endpoints.py 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@greptile-apps

greptile-apps Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This backport cherry-picks the GHSA-q775 session-token exemption fix (#29612) onto the stable/1.87.x line and cuts version 1.87.2. The previous review comment about reading data.team_id after defaults mutation is fully resolved: _requested_team_id is now captured immediately after _requested_max_budget, before the default_key_generate_params loop, and the is_ui_session_team_key gate is keyed off this pre-defaults snapshot.

  • key_management_endpoints.py: Adds _requested_team_id = data.team_id before the defaults loop; uses it in is_ui_session_team_key so the exemption fires only when the caller explicitly supplies a team key, not when a default config injects one.
  • Tests: Three new regression tests cover the happy path (UI session + explicit team key → exempt), the security boundary (UI session + no team_id → ceiling still fires), and the defaults-injection edge case (UI session + default-filled team_id → ceiling still fires).
  • pyproject.toml: Version bumped to 1.87.2; uv.lock refreshed to match.

Confidence Score: 5/5

Safe to merge — the exemption logic is correct, and the prior concern about post-defaults data.team_id leaking into the check has been fully addressed.

The fix is minimal and targeted: _requested_team_id is captured before the defaults loop, mirroring the existing _requested_max_budget pattern, and the exemption gate uses it correctly. The three new regression tests cover the team-key happy path, the personal-key ceiling boundary, and the default-injected team_id edge case that was flagged in the previous review. No logic gaps remain.

No files require special attention.

Important Files Changed

Filename Overview
litellm/proxy/management_endpoints/key_management_endpoints.py Adds _requested_team_id capture before the defaults loop, then gates the is_ui_session_team_key exemption on it; addresses the prior review concern about post-defaults data.team_id leaking into the check.
tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py Adds three targeted regression tests: team-key exemption succeeds, personal-key ceiling still fires, and default-injected team_id does not bypass the ceiling.
pyproject.toml Version bump 1.87.1 → 1.87.2 in both [project] and [tool.commitizen] blocks; no other changes.

Reviews (2): Last reviewed commit: "fix(key_generate): harden GHSA-q775 sess..." | Re-trigger Greptile

Comment thread litellm/proxy/management_endpoints/key_management_endpoints.py
@mateo-berri mateo-berri disabled auto-merge June 4, 2026 01:03
…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
@mateo-berri

Copy link
Copy Markdown
Collaborator Author

@greptileai

@mateo-berri mateo-berri merged commit cc2aff3 into stable/1.87.x Jun 4, 2026
70 of 75 checks passed
@mateo-berri mateo-berri deleted the litellm_cherrypick_1_87_2 branch June 4, 2026 02:20
Jason869905 pushed a commit to Jason869905/litellm that referenced this pull request Jun 6, 2026
The latest 1.87.x GitHub release is v1.87.0, so the branch should sit one patch
ahead at 1.87.1 as the patch-to-be. The GHSA-q775 backport (BerriAI#29636) additionally
bumped 1.87.1 -> 1.87.2, cutting a version ahead of release. This reverts just the
version bump and its uv.lock refresh, keeping the backported fix and hardening
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants