Skip to content

fix(proxy): verify offline licenses with dotted payloads - #48327

Draft
tanishqbaweja wants to merge 2 commits into
BerriAI:mainfrom
tanishqbaweja:litellm_fix_26231_airgapped_license
Draft

tanishqbaweja wants to merge 2 commits into
BerriAI:mainfrom
tanishqbaweja:litellm_fix_26231_airgapped_license

Conversation

@tanishqbaweja

@tanishqbaweja tanishqbaweja commented Oct 25, 2026 •

Copy link
Copy Markdown

Valid offline licenses now work when their signed payload contains dots, including domain names in user IDs. The verifier locates the signature using the RSA key size while preserving signature and expiry validation

Details

TLDR

Problem this solves

  • Splitting at the first dot truncates valid signed payloads

How it solves it

  • Read the RSA signature's byte width and validate its separator
  • Cover dotted payloads, binary signature dots, and malformed inputs

User Flow

Before, an offline admin with a valid dotted license cannot open licensed settings

  1. Start the proxy with that license and sign in at http://127.0.0.1:41475/ui/login
  2. Open http://127.0.0.1:41475/ui/admin-panel, choose Security Settings, then UI Access Control
  3. The dashboard reports that only premium users can configure access control, including after reload

Before, valid dotted test license rejected

After, the same license enables the settings offline

  1. Start the proxy with that license and sign in at http://127.0.0.1:41475/ui/login
  2. Open http://127.0.0.1:41475/ui/admin-panel, choose Security Settings, then UI Access Control
  3. The settings dialog opens with usable controls, including after reload

After, license verified offline

Relevant issues

Fixes #26231

Credits the signature-width approach in #26234, which closed unmerged. This fix uses the current mapped tests and also covers non-byte-aligned keys and raw dots inside the signature

Testing

The final license tests produce six failures and 38 passes on the original verifier. The fixed license and adjacent health endpoint tests pass, 333 tests with 23 warnings

python -m pytest tests/unit/proxy/auth/test_litellm_license.py tests/unit/proxy/health_endpoints/test_health_endpoints.py -q
make format
ruff format --check tests/unit/proxy/auth/test_litellm_license.py
make lint BASE_REF=origin/main LINT_JOBS=2
git diff --check origin/main...HEAD

All listed checks pass. The full lint target includes the repository's type-budget gates and end-to-end type check. Four targeted mutations also fail as intended, last-dot splitting, rounding the signature width down, ignoring the separator, and skipping RSA verification. Their assertion failure counts are 1, 3, 1 and 3 respectively, followed by a passing run after restoring the source

Formatting, full lint and mutation checks ran on db1791631208a8d1065cdb393185404c51c26555, whose content tree is identical to the current tip. The affected tests were rerun on the current tip, 333 passes in 15.72s, alongside the fresh live API and browser checks below

Complete check record and logs

Pre-Submission checklist

  • I have added meaningful tests
  • The affected test files pass locally
  • My PR passes all required CI/CD checks
  • My PR only solves one specific problem
  • Every automated review on the latest commit has finished and its findings are addressed

All four required checks pass on b7496a18a86bd7a0639513635738eb2dc9430047, unit, lint, smoke and cost map. The coverage job also passes, and Codecov reports that all modified coverable lines are covered

The initial unit run hit an existing tokenizer timing failure, also reproduced separately on unchanged main. GitHub denied the targeted rerun because it requires repository admin rights. One empty commit retried CI successfully with unchanged code and tests. The 333 affected tests and all ten API checks and four browser workflows were rerun on that tip, with fresh screenshots and recordings. Failure measurements and retry record. Automated code reviews have not been posted

The OSV scan reports the same three unfiltered dependency advisories as unchanged main, GHSA-567q-5qvw-pf92 and GHSA-9vhv-jxww-xfm5 in filelock, plus GHSA-xcx6-jx8p-x3h5 in the development dependency @azure/msal-node. Existing upstream proposal #48302 tracks those findings

Screenshots / Proof of Fix

Both revisions use the same generated RSA test key and signed inputs, a real proxy and PostgreSQL, and the unchanged dashboard export from main. The test public key is installed only in the private verification worktrees. The remote license server is unreachable. This exercises actual cryptographic verification with generated licenses, not an issued production license

Setup, signed payload metadata and all ten live curl results

Before (dddbaa8)

Offline license status

  1. Start the proxy with the generated dotted license and run curl --fail-with-body -H "Authorization: Bearer $LITELLM_MASTER_KEY" http://127.0.0.1:41475/health/license
  2. The actual HTTP 200 reply reports license_type: community, empty features and null limits
  3. Repeat with the plain, unpadded, expired and tampered fixtures. Only the plain valid license is accepted

Desktop and phone dashboard

  1. Follow the User Flow at 1440x900 and 390x844 with touch, using a fresh login each time
  2. Both sessions have premium_user: false and show the rejection pictured above and in the phone screenshot
  3. Reload and repeat, the rejection remains. Desktop recording, phone recording

After (b7496a1)

Offline license status

  1. Start the proxy with the same dotted license and run curl --fail-with-body -H "Authorization: Bearer $LITELLM_MASTER_KEY" http://127.0.0.1:41475/health/license
  2. The actual HTTP 200 reply reports license_type: enterprise with the signed expiration, features and limits intact
  3. Repeat with the same controls. Plain and unpadded valid licenses work, expired and tampered licenses stay rejected

Desktop and phone dashboard

  1. Follow the same User Flow and viewport sizes with fresh logins
  2. Both sessions have premium_user: true and open the dialog pictured above and in the phone screenshot
  3. Select Restricted SSO Group, fill the fields, close without saving, reload and reopen. Desktop recording, phone recording

All 14 raw screenshots, four annotated screenshots and eight sampled frames per recording were visually inspected. All four browser cases pass with no JavaScript exceptions or HTTP 5xx responses

Caveats

Low

  • Verification uses generated test licenses and a test trust key
  • Existing phone tabs overlap the panel on both revisions
  • Existing static 404s remain, with no new failing paths
  • Browser checks cover license gating, not SSO provider sign-in

Type

Bug Fix

@codspeed

codspeed Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

1 warning

⚠️ 1 benchmark is dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 35 untouched benchmarks


Comparing tanishqbaweja:litellm_fix_26231_airgapped_license (b7496a1) with main (72f1ac4)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (dddbaa8) during the generation of this report, so 72f1ac4 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@codecov

codecov Bot commented Oct 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@CLAassistant

CLAassistant commented Nov 3, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

This branch has not been deployed

No deployments
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]: Airgapped license verification fails when the license payload contains "." (e.g. a domain-like user_id)

2 participants