Files
open-webui/backend/open_webui
Classic298 0fc630b34b fix: per-user model cache used static key= (cross-user model exposure) (#25783)
routers/openai.py and routers/ollama.py decorated get_all_models with
`@cached(key=lambda _, user: ...)`. In aiocache 0.12, `key=` is a STATIC
cache key: get_cache_key returns `self.key` verbatim (the lambda object)
without calling it, so every caller collides to ONE shared entry within
the TTL. The intended per-user namespacing never happened — one user's
permission-filtered model list could be served to another user (or an
anonymous caller) during the cache window.

The per-call hook is `key_builder=` (called as key_builder(func, *args,
**kwargs)). Switch both sites to key_builder with a (func, request,
user=None) signature so the key is built per call. user=None mirrors
ollama's optional-user signature and stays correct whether user is passed
positionally, as a kwarg, or omitted.

Verified offline: old form returns the same key object for distinct users
(collision); new form yields distinct openai_all_models_<id> /
ollama_all_models_<id> keys, and the unauthenticated base key when no user.
These two were the only @cached(key=lambda ...) sites in the backend.
2026-06-29 03:51:02 -05:00
..
2026-06-17 02:52:35 +02:00
2026-06-29 00:21:37 -05:00
2026-06-29 02:26:27 -05:00
2026-06-01 14:10:40 -07:00
2026-06-29 00:46:45 -05:00
2026-06-29 03:42:36 -05:00
2026-06-17 03:01:11 +02:00
2026-06-29 01:52:07 -05:00
2026-06-29 03:42:36 -05:00
2026-06-25 15:56:10 +01:00
2026-06-29 02:57:58 -05:00