From 9e25578ee6cfddd576d558ad3d0406ead51771b3 Mon Sep 17 00:00:00 2001 From: Inferencebot Date: Fri, 6 Nov 2026 03:55:36 +0000 Subject: [PATCH] upgrade: pin LiteLLM v1.108.0 (candidate for 2026-11-08 window) - Dockerfile FROM v1.103.2 -> v1.108.0; manifest upstreamVersion follows. - patch_expose_cost_headers.py: upstream 1.108.0 refactored the CORS middleware call (expose_headers now also spreads trace_response_expose_headers()), so the 1.103.x anchor no longer matched and the patch would have SILENTLY stopped applying. The script now handles both anchor shapes (1.103.x first, 1.108.x fallback). - All 8 build patches verified against the real v1.108.0 sources: every anchor matched, every patched file compiles, re-runs are idempotent. - 36 new migrations, all additive (no unguarded DROP/DELETE/UPDATE); budget_reset_at unchanged on LiteLLM_TeamTable; SpendLogs gains only billing_agent_id. --- CloudronManifest.json | 2 +- Dockerfile | 2 +- README.md | 4 +++- patch_expose_cost_headers.py | 41 +++++++++++++++++++++++++++++------- 4 files changed, 38 insertions(+), 11 deletions(-) diff --git a/CloudronManifest.json b/CloudronManifest.json index c72a0fa..380eec8 100644 --- a/CloudronManifest.json +++ b/CloudronManifest.json @@ -5,7 +5,7 @@ "description": "LiteLLM AI Gateway \u2014 OpenAI-compatible proxy with per-user API keys, usage tracking, rate limiting, and model routing. Packaged for Cloudron with SSO/OIDC and PostgreSQL.", "tagline": "AI gateway for cooperative inference", "version": "1.0.0", - "upstreamVersion": "1.103.2", + "upstreamVersion": "1.108.0", "healthCheckPath": "/health/readiness", "httpPort": 4000, "memoryLimit": 2147483648, diff --git a/Dockerfile b/Dockerfile index 6c264d1..2c7d51a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/berriai/litellm:v1.103.2 +FROM ghcr.io/berriai/litellm:v1.108.0 # v1.84.0 is the fix line for CVE-2026-35029 (auth bypass on # /config/update, fixed 1.83.0) and CVE-2026-59822 (MCP session auth diff --git a/README.md b/README.md index 7a701f1..d030e77 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,9 @@ A Cloudron app package for [LiteLLM](https://litellm.ai/), the open-source AI ga LiteLLM is the single gateway between members and the inference backends. It handles per-member API keys, usage metering, rate limiting (via budget caps), and model routing — all behind one OpenAI-compatible endpoint. -**Current base image:** LiteLLM **v1.103.2**, pinned to the exact tag (fix line for CVE-2026-35029 / CVE-2026-59822, CISA KEV-listed; also carries the streaming-usage fix for prompt_tokens_details). See [Updating LiteLLM](#updating-litellm). +**Current base image:** LiteLLM **v1.108.0**, pinned to the exact tag (upgraded +from v1.103.2 on the 2026-11-08 maintenance window; minimum supported line remains +v1.84.0, the fix line for CVE-2026-35029 / CVE-2026-59822, CISA KEV-listed). See [Updating LiteLLM](#updating-litellm). ## What this provides diff --git a/patch_expose_cost_headers.py b/patch_expose_cost_headers.py index 72f9bc1..e302ef9 100644 --- a/patch_expose_cost_headers.py +++ b/patch_expose_cost_headers.py @@ -4,7 +4,9 @@ MEMBER REQUEST (co-op/support#39, 2026-10-31). Browser JS calling the gateway fr another origin cannot read a response header unless the server names it in Access-Control-Expose-Headers. LiteLLM sets - expose_headers=LITELLM_UI_ALLOW_HEADERS + expose_headers=LITELLM_UI_ALLOW_HEADERS # through 1.103.x + expose_headers=[*LITELLM_UI_ALLOW_HEADERS, + *trace_response_expose_headers()] # from 1.108.0 which covers seven names (semantic-filter, guardrail, cache-key, ...) and none of the cost ones — so `x-litellm-response-cost*` reads as null in JS even though the @@ -62,6 +64,20 @@ NEW = ( + " ],\n" ) +# 1.108.0 refactored the middleware call (upstream added the trace-response +# header set to expose_headers). Same operation, new anchor; tried when the +# 1.103.2 shape is absent so the script works against either base image. +OLD_V1108 = ( + " expose_headers=[*LITELLM_UI_ALLOW_HEADERS, *trace_response_expose_headers()],\n" +) +NEW_V1108 = ( + " expose_headers=[\n" + " *LITELLM_UI_ALLOW_HEADERS,\n" + " *trace_response_expose_headers(),\n" + + "".join(f' "{h}",\n' for h in EXPOSED_HEADERS) + + " ],\n" +) + def main() -> int: # Glob rather than pin a Python version: the venv path moves when the base @@ -76,13 +92,22 @@ def main() -> int: if "x-litellm-response-cost-input" in src: print("expose-cost-headers: already applied") return 0 - found = src.count(OLD) - if found != 1: - print(f"WARN expose-cost-headers: expected exactly 1 CORS middleware call, found {found} — skipping") - return 0 - - target.write_text(src.replace(OLD, NEW)) - print(f"expose-cost-headers: appended {len(EXPOSED_HEADERS)} cost header names to expose_headers in {target}") + for old, new, shape in ((OLD, NEW, "1.103.x"), (OLD_V1108, NEW_V1108, "1.108.x")): + found = src.count(old) + if found == 1: + target.write_text(src.replace(old, new)) + print( + f"expose-cost-headers: appended {len(EXPOSED_HEADERS)} cost header names " + f"to expose_headers (anchor {shape}) in {target}" + ) + return 0 + if found > 1: + print(f"WARN expose-cost-headers: expected exactly 1 {shape} CORS middleware call, found {found} — skipping") + return 0 + print( + "WARN expose-cost-headers: no known expose_headers anchor found " + "(neither 1.103.x nor 1.108.x shape) — skipping" + ) return 0