Skip to content

chore(release): patch v1.88.0-rc.1 with #29612 (session-token budget-ceiling exemption)#29637

Merged
mateo-berri merged 1 commit into
patch/v1.88.0-rc.1from
litellm_cherrypick_1_88_0_rc3
Jun 4, 2026
Merged

chore(release): patch v1.88.0-rc.1 with #29612 (session-token budget-ceiling exemption)#29637
mateo-berri merged 1 commit into
patch/v1.88.0-rc.1from
litellm_cherrypick_1_88_0_rc3

Conversation

@mateo-berri

Copy link
Copy Markdown
Collaborator

Relevant issues

Adds #29612 (fixes #29073) to the patch/v1.88.0-rc.1 line, which already carries the earlier batch (#29632). Cherry-picked from the squashed commit that landed on litellm_internal_staging (97ba7e1a30)

What is included

No version bump: the 1.88 line keeps pyproject.toml at 1.88.0 and the rc number is a git tag, matching how the prior rc patch was cut

#29612 applies cleanly here: the rc 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)

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

Type

Bug Fix

Changes

See the commit list. No new code beyond the cherry-pick


Generated by Claude Code

…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 ryan-crabbe-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 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...y/management_endpoints/key_management_endpoints.py 0.00% 1 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 PR cherry-picks #29612 onto the patch/v1.88.0-rc.1 line, adding an exemption to the GHSA-q775 delegated-authority budget ceiling for UI/CLI session tokens when they are creating team keys.

  • Key logic change (key_management_endpoints.py): introduces is_ui_session_team_key (caller team_id == UI_SESSION_TOKEN_TEAM_ID AND data.team_id is not None) and short-circuits the ceiling check for that case, because the session token's max_budget is a per-session chat cap, not delegation authority; the team budget bounds actual spend at request time. Personal key creation by session tokens is unchanged — the ceiling still applies there.
  • Tests (test_key_management_endpoints.py): two new async tests cover both sides — test_ghsa_q775_ui_session_token_team_key_exempt_from_budget_ceiling calls _common_key_generation_helper directly so the ceiling code runs, and test_ghsa_q775_ui_session_token_personal_key_still_capped confirms the 400 ceiling error still fires for personal keys created by session tokens.

Confidence Score: 4/5

The change is tightly scoped — two conditions must both hold for the exemption to fire, and the security test explicitly guards the personal-key regression case.

The logic is straightforward and well-commented: the is_ui_session_team_key guard requires both that the caller's team_id matches the internal sentinel value and that the new key is being created for an explicit team. Both new tests exercise the critical paths. The one weakness is that the exemption-positive test (try/except pattern) could silently pass if the function aborts for an unrelated reason after the ceiling check, making it a slightly weaker regression guard than it could be. No other functional issues were found.

The test file's test_ghsa_q775_ui_session_token_team_key_exempt_from_budget_ceiling warrants a closer look due to its try/except assertion style.

Important Files Changed

Filename Overview
litellm/proxy/management_endpoints/key_management_endpoints.py Adds is_ui_session_team_key exemption to the GHSA-q775 delegated-authority budget ceiling; scoped to session tokens creating team keys, personal key creation keeps the ceiling.
tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py Adds two new async tests: one verifying the exemption fires for team-key creation, one confirming the ceiling still applies for personal keys.

Reviews (1): Last reviewed commit: "fix(key_generate): exempt UI/CLI session..." | Re-trigger Greptile

Comment on lines +11573 to +11584
try:
await _common_key_generation_helper(
data=data,
user_api_key_dict=user_api_key_dict,
litellm_changed_by=None,
team_table=MagicMock(),
)
except (HTTPException, ProxyException) as err:
msg = str(getattr(err, "detail", "")) + str(getattr(err, "message", ""))
assert (
"cannot exceed" not in msg.lower()
), "UI/CLI session token creating a team key must be exempt from the ceiling"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Weak positive assertion for the exemption test

The try/except structure here checks that the "cannot exceed" error does not appear, but it silently passes whenever the function raises any other HTTPException/ProxyException (e.g., a downstream mock returning an unexpected value and triggering a 500). That means the test can green without proving that the exemption path actually let execution flow past the ceiling check. A stronger approach would add an else branch or track whether the exception was caught at all, so a success path (no exception) is explicitly distinguished from a masked failure path.

@mateo-berri mateo-berri merged commit c2a0a6a into patch/v1.88.0-rc.1 Jun 4, 2026
67 of 75 checks passed
@mateo-berri mateo-berri deleted the litellm_cherrypick_1_88_0_rc3 branch June 4, 2026 00:16
# at request time. Personal keys keep the ceiling; nothing else bounds them.
is_ui_session_team_key = (
user_api_key_dict.team_id == UI_SESSION_TOKEN_TEAM_ID
and data.team_id is not None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium: Budget ceiling bypass through default team assignment

data.team_id can be populated by litellm.default_key_generate_params just above this check, after generate_key_fn has already decided whether to run team-key membership and limit checks. A UI session caller can omit team_id and request a large max_budget; in deployments with a default team_id, this exemption then mints a high-budget team key instead of enforcing the caller's session budget ceiling.

Suggested change
and data.team_id is not None
and data.team_id is not None
and team_table is not None

@veria-ai

veria-ai Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

PR overview

This PR patches the v1.88.0-rc.1 release by updating key management behavior around the session-token budget-ceiling exemption. The touched code is in the proxy key generation endpoint, where request defaults and team/session parameters are applied.

There is one open security issue remaining. A UI session caller may be able to omit a team ID and rely on a configured default team assignment to generate a team key with a higher budget than their session ceiling should allow. No issues have been addressed yet, so the PR still needs a targeted fix before the budget-ceiling change is safe to merge.

Open issues (1)

Fixed/addressed: 0 · PR risk: 5/10

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.

3 participants