Skip to content

fix(proxy): enforce auth defaults for raw pass-through config - #39017

Open
lzhan011 wants to merge 1 commit into
BerriAI:litellm_internal_stagingfrom
lzhan011:bugfix/pass-through-auth-default
Open

lzhan011 wants to merge 1 commit into
BerriAI:litellm_internal_stagingfrom
lzhan011:bugfix/pass-through-auth-default

Conversation

@lzhan011

@lzhan011 lzhan011 commented Aug 31, 2026

Copy link
Copy Markdown

TLDR

Problem this solves:

  • Raw pass-through config can skip centralized policy checks
  • Missing auth disagrees with the typed secure default

How it solves it:

  • Defaults missing raw auth values to true
  • Covers route registration and centralized checks with regressions

User Flow

Before: a proxy admin omits auth and an exhausted key can still reach the pass-through upstream

  1. The admin configures /internal/provider without an auth field and restarts the proxy
  2. A developer sends POST https://litellm-domain/internal/provider with a valid virtual key whose budget is exhausted
  3. The request reaches the configured upstream instead of returning a budget error
  4. The developer can continue using the upstream beyond the key's configured policy

After: the same request is stopped by the policy already attached to the key

  1. The admin configures /internal/provider without an auth field and restarts the proxy
  2. A developer sends POST https://litellm-domain/internal/provider with a valid virtual key whose budget is exhausted
  3. The proxy returns HTTP 429 with the budget-exceeded error before contacting the upstream
  4. The developer can no longer bypass the key's configured policy through this route

Relevant issues

Fixes #35534

Linear ticket

Pre-Submission checklist

  • I have added meaningful tests
  • The test files covering my change pass locally
  • My PR passes all required CI/CD checks
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 on the latest head

Local checks

  • Related auth selection: 36 passed, 133 deselected
  • The branch is rebased onto the latest litellm_internal_staging
  • The PR has no merge conflicts

Screenshots / Proof of Fix

A live before/after curl run needs a DB-backed proxy so the same virtual key can be placed over budget. This checkout has no PostgreSQL service or DATABASE_URL

Before (97dbd8e)

  1. Not captured locally because the required DB-backed key state is unavailable

After (754c3d5)

  1. Not captured locally for the same reason

Type

Bug Fix

Caveats (if any)

CI baseline

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

@CLAassistant

CLAassistant commented Aug 31, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@greptile-apps

greptile-apps Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR aligns omitted raw pass-through authentication settings with the typed secure default and adds focused regression coverage

  • Defaults omitted raw endpoint authentication to enabled during route registration
  • Keeps centralized policy checks active when raw endpoint configuration omits auth
  • Adds registration and centralized-check regression tests

Confidence Score: 5/5

The PR appears safe to merge

No blocking failure remains

Important Files Changed

Filename Overview
litellm/proxy/auth/user_api_key_auth.py Centralized checks now treat an omitted raw pass-through auth field as authenticated, matching the request-time default
litellm/proxy/pass_through_endpoints/pass_through_endpoints.py Raw pass-through route registration now defaults omitted authentication to enabled
tests/test_litellm/proxy/auth/test_user_api_key_auth.py Adds focused coverage confirming centralized checks still execute when raw pass-through configuration omits auth
tests/test_litellm/proxy/pass_through_endpoints/test_passthrough_auth_default.py Adds focused registration coverage for the secure omitted-auth default

Reviews (2): Last reviewed commit: "fix(proxy): enforce auth defaults for ra..." | Re-trigger Greptile

@codspeed

codspeed Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing lzhan011:bugfix/pass-through-auth-default (b69818f) with litellm_internal_staging (987ab76)

Open in CodSpeed

@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@lzhan011
lzhan011 force-pushed the bugfix/pass-through-auth-default branch 3 times, most recently from f7fc5ee to 754c3d5 Compare September 1, 2026 22:17

lzhan011 commented Sep 1, 2026

Copy link
Copy Markdown
Author

@greptileai please re-review the auth-default changes after rebasing onto the latest staging branch and retaining the focused regression coverage

@lzhan011

lzhan011 commented Sep 2, 2026

Copy link
Copy Markdown
Author

OSV failure is tracked in #39217 and comes from unchanged staging locks; this PR only changes pass-through authentication code and tests

@lzhan011
lzhan011 force-pushed the bugfix/pass-through-auth-default branch from 754c3d5 to b69818f Compare September 2, 2026 19:47
@yuneng-berri
yuneng-berri deleted the branch BerriAI:litellm_internal_staging September 13, 2026 04:47
@yuneng-berri yuneng-berri reopened this Sep 13, 2026
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.

[Bug]: Pass-through endpoints from raw config dicts skip centralized common checks

3 participants