fix(proxy): make common_checks opt-in for custom auth - #22678
Merged
Conversation
…_run_common_checks Replaces the skip_route_check approach from PR BerriAI#22662 with a configurable opt-in flag. By default, common_checks() is not run for custom auth flows, preserving backwards compatibility with pre-BerriAI#22164 behavior. Users who want budget/team/route enforcement on custom auth can enable it: general_settings: custom_auth_run_common_checks: true Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Greptile SummaryThis PR replaces the
Confidence Score: 4/5
|
| Filename | Overview |
|---|---|
| litellm/proxy/auth/auth_checks.py | Reverts skip_route_check parameter from common_checks(), restoring the unconditional route check. Clean removal with no remaining references. |
| litellm/proxy/auth/user_api_key_auth.py | Wraps common_checks() call in _run_post_custom_auth_checks() behind general_settings.get("custom_auth_run_common_checks", False) opt-in flag, preserving backwards compatibility. |
| tests/test_litellm/proxy/auth/test_auth_checks.py | Rewrites test to verify opt-in behavior of _run_post_custom_auth_checks with mock-only approach. Tests both default (skipped) and opt-in (called) paths. |
| tests/test_litellm/proxy/auth/test_custom_auth_end_user_budget.py | Adds assertions verifying common_checks is not awaited by default and adds new test case for the opt-in flag enabling common_checks. |
| docs/my-website/docs/proxy/guardrails/quick_start.md | Fixes guardrails doc examples: changes [] to {} for per-guardrail config syntax, and removes duplicate closing braces in curl examples. Unrelated to the main auth change. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Custom Auth returns UserAPIKeyAuth] --> B["_run_post_custom_auth_checks()"]
B --> C{end_user_id set?}
C -->|Yes| D[Lookup end_user + apply budget]
C -->|No| E[Skip end_user lookup]
D --> F[Key expiry + model budget checks]
E --> F
F --> G{custom_auth_run_common_checks?}
G -->|"True (opt-in)"| H["common_checks() — route, budget, team, guardrails"]
G -->|"False (default)"| I[Skip common_checks]
H --> J[Return valid_token]
I --> J
Last reviewed commit: a6b57f9
fzowl
pushed a commit
to fzowl/litellm
that referenced
this pull request
Jun 24, 2026
…opt_in fix(proxy): make common_checks opt-in for custom auth
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the
skip_route_checkapproach from PR #22662 with a configurable opt-inBy default,
common_checks()is not run for custom auth flows, preserving backwards compatibility with pre-#22164 behavior. Users who want budget/team/route enforcement on custom auth can explicitly opt in:Changes
skip_route_checkparameter fromcommon_checks()inauth_checks.pycommon_checks()call in_run_post_custom_auth_checks()behindgeneral_settings.get("custom_auth_run_common_checks", False)Pre-Submission checklist
tests/litellm/directoryType
🐛 Bug Fix