revert(auth): backport the teamless all-team-models denial revert (#32032) to 1.91.0rc1 - #32100
Conversation
|
|
Greptile SummaryThis PR backports #32032 to the
Confidence Score: 4/5Safe to merge; the two production changes are minimal, well-scoped reverts and the test additions strengthen regression coverage on all touched surfaces. Both production hunks faithfully restore the original pre-#29746 semantics: No files require special attention.
|
| Filename | Overview |
|---|---|
| litellm/proxy/auth/auth_checks.py | _resolve_key_models_for_auth_check: returns [] for teamless all-team-models keys (unrestricted) instead of the sentinel list (implicit denial). Logic and docstring are consistent. |
| litellm/proxy/auth/model_checks.py | get_key_models: drops the team_id is not None guard so the all-team-models sentinel is always expanded to team_models; for teamless keys team_models is [] so the function returns [] (unrestricted), matching auth_checks.py semantics. |
| tests/test_litellm/proxy/auth/test_auth_checks.py | Denial test renamed and assertions flipped to match reverted behavior; five new regression tests added covering _resolve_key_models_for_auth_check, _enforce_key_and_fallback_model_access, and can_key_call_resolved_model for teamless all-team-models keys. |
| tests/test_litellm/proxy/auth/test_model_checks.py | New test test_get_key_models_teamless_all_team_models_returns_unrestricted verifies that get_key_models returns [] (unrestricted) for teamless all-team-models keys and that the sentinel string does not leak into the result. |
| tests/test_litellm/proxy/hooks/test_batch_file_validation.py | New test test_pre_call_allows_teamless_all_team_models_key verifies the batch path allows teamless all-team-models keys, consistent with the inference path revert. |
Reviews (1): Last reviewed commit: "revert: undo teamless all-team-models de..." | Re-trigger Greptile
| if SpecialModelNames.all_team_models.value in models: | ||
| if valid_token.team_id is None: | ||
| return models | ||
| return [] |
There was a problem hiding this comment.
High: Teamless key model restriction bypass
An authenticated user can create a personal key with models: ["all-team-models"] and no team_id; this now resolves to [], which _check_model_access_helper treats as all-model access. Keep the sentinel unresolved for teamless keys so it fails closed instead of granting every proxy model; the matching get_key_models change should also preserve that behavior for teamless keys.
| return [] | |
| return models |
There was a problem hiding this comment.
This is the intended behavior of the backported change, not a regression introduced here. Treating a teamless key with models=["all-team-models"] as unrestricted was the long-standing semantics; the fail-closed denial this suggestion asks for is exactly what #29746 and #32022 introduced and what #32032 deliberately reverted upstream (already merged to litellm_internal_staging) because the denial broke existing deployments. This PR only brings the rc line back in sync: the touched functions are byte-identical to current staging. If teamless all-team-models keys should fail closed, that is a product decision to relitigate upstream, and the backport should not diverge from staging on it
PR overviewThis pull request backports an authentication-related revert for the 1.91.0 release candidate, changing how teamless personal keys interact with the There is one open access-control issue remaining: an authenticated user can create a teamless personal key using the Open issues (1)
Fixed/addressed: 0 · PR risk: 7/10 |
Relevant issues
Backports #32032 to the 1.91.0rc1 patch line. That PR reverted the teamless all-team-models denial introduced by #29746 and #32022, restoring the original behavior where a teamless key with
models=["all-team-models"]is treated as unrestricted (equivalent to an empty models field)Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewDelays 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
The full touched test surface passes locally on this branch:
tests/test_litellm/proxy/auth/test_auth_checks.py,tests/test_litellm/proxy/auth/test_model_checks.pyandtests/test_litellm/proxy/hooks/test_batch_file_validation.py(237 passed), plustests/test_litellm/proxy/auth/test_user_api_key_auth.py(103 passed). That includes the six regression tests from #32032 covering listing, inference, resolved-model and batch surfacesType
🐛 Bug Fix
Changes
Single cherry-pick of the #32032 squash (5ece78f) onto
patch-1.91.0rc1, with original authorship preservedThe rc line contains #29746 (backported as 074455c) but never received #32022, so the #32022-revert hunks in
user_api_key_auth.pyandcan_key_call_resolved_modelresolved as already applied (the rc line was still in the pre-#32022 state the revert restores) and that file carries no net change. The two effective prod changes are exactly the #29746 teamless-denial reverts:_resolve_key_models_for_auth_checkreturns[](unrestricted) for teamless keys instead of the unresolvable sentinel, andget_key_modelsdrops theteam_id is not NoneguardOne conflict, in
tests/test_litellm/proxy/auth/test_auth_checks.py, where the rc line's #29746 denial test differed from staging's; resolved by taking the incoming side, which is upstream's post-revert content verbatim. After resolution,_resolve_key_models_for_auth_check,can_key_call_resolved_modeland_enforce_key_and_fallback_model_accessare byte-identical to currentlitellm_internal_staging, andmodel_checks.pyis byte-identical as a whole fileNo version bump, per rc line convention (rc number lives in the git tag only)