fix(proxy): allow custom auth routes to bypass route authorization ch… - #22662
Merged
Conversation
…ecks Custom user-added routes (e.g. /ldap/ngs/ready) used with Depends(user_api_key_auth) were being rejected as admin-only after _run_post_custom_auth_checks was introduced in commit 14badde. The route authorization check in common_checks is designed for LiteLLM's own management routes. Custom auth flows that add their own routes should be trusted since the custom auth function already validated the request. Budget and expiry checks still run. Add skip_route_check parameter to common_checks() and pass skip_route_check=True from _run_post_custom_auth_checks() to skip route authorization while preserving budget/team/model checks. Regression test added: test_common_checks_skip_route_check_for_custom_auth Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Greptile SummaryThis PR fixes a regression where custom user-defined auth routes (e.g.,
Confidence Score: 4/5
|
| Filename | Overview |
|---|---|
| litellm/proxy/auth/auth_checks.py | Adds skip_route_check parameter to common_checks() and wraps the _is_allowed_route call in a conditional block. Clean, minimal change that doesn't affect other callers. |
| litellm/proxy/auth/user_api_key_auth.py | Passes skip_route_check=True to common_checks() in _run_post_custom_auth_checks, the only call site that handles custom auth flows. |
| tests/test_litellm/proxy/auth/test_auth_checks.py | Adds a regression test using mocks to verify custom routes pass with skip_route_check=True and fail without it. No real network calls. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Request arrives] --> B{Custom auth configured?}
B -->|Yes| C[enterprise_custom_auth / user_custom_auth validates request]
B -->|No| D[Standard JWT / Key-based auth]
C --> E["_run_post_custom_auth_checks()"]
E --> F["common_checks(skip_route_check=True)"]
F --> G[Budget checks, team checks, etc.]
G --> H[Skip _is_allowed_route]
H --> I[Vector store checks]
I --> J[Return True]
D --> K["common_checks(skip_route_check=False)"]
K --> L[Budget checks, team checks, etc.]
L --> M["_is_allowed_route() — enforces route authorization"]
M --> N[Vector store checks]
N --> J
Last reviewed commit: 6d535e5
Harshit28j
added a commit
to Harshit28j/litellm
that referenced
this pull request
Mar 3, 2026
…_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>
3 tasks
fzowl
pushed a commit
to fzowl/litellm
that referenced
this pull request
Jun 24, 2026
…_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
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.
Uh oh!
There was an error while loading. Please reload this page.