An empty allowlist matches nothing, so it denies every address. That is a
reasonable thing to configure on purpose, and it is what the code already did.
The problem was that removing the last entry produced one as a side effect,
which locked every caller out with no way back through the API.
So the delete endpoint now drops the key instead of storing [], and the
enforcement check and the startup Enterprise gate are left exactly as they
were. Setting allowed_ips: [] by hand still denies everything.
Reverts the earlier enforcement and gate changes on this branch, which had
made [] mean "no allowlist" and so removed the ability to express deny all.
The previous check treated any falsy allowed_ips as an unset allowlist, so a
malformed scalar such as an empty string would have admitted every address.
Only None and an empty list mean "not configured" now; anything else falls
through to the membership check and is refused, which is what the old code did
for those values too.
Self-review found three consequences of dropping the key instead of storing an
empty list.
Two parametrized cases in tests/proxy_unit_tests asserted the old contract,
that an empty allowlist denies every address. They now assert the new one.
The Admin panel refreshed its list after a delete with an unguarded
updatedIPs.length, so once the last address was removed and /get/allowed_ips
answered null, a successful delete surfaced a TypeError toast and the list
never refreshed. It now null-guards the way the fetch path alongside it
already does.
Delete removed the first matching address in memory but every match from the
persisted config, so a hand-written duplicate left the two views disagreeing,
with the runtime one still honouring the address it had just reported deleted.
Both paths now filter.
Self-review found two mutants that survived the first round of tests. Disabling
the boot-time Enterprise check for allowed_ips entirely, and disabling the 404
branch that rejects deleting an IP that was never added, both left every test
green. Neither branch was exercised anywhere in the suite.
Deleting the last entry via POST /delete/allowed_ip stored
general_settings.allowed_ips = [] in the LiteLLM_Config row. An empty list is
not None, so the IP check read it as "an allowlist is configured and nothing
matches" and answered 403 to every caller from every address, including the
/add/allowed_ip call needed to put an IP back. Recovery needed direct database
access.
Fixed at both ends. The IP check now treats a falsy allowlist the same as an
unset one, which also heals deployments already holding a stored []. The delete
endpoint drops the key entirely once the list empties, so the trap is not
re-armed. The boot-time enterprise-license gate had the same blind spot and
would refuse to start a non-premium proxy over an empty list.
/config/field/info used to answer from the LiteLLM_Config row, so "the field
400s" proved the row did not carry it. It now answers from the resolved
settings, and the CI stack config declares general_settings.max_parallel_requests,
so the endpoint returns that value and the old assertion could never hold.
The check that /add/allowed_ip writes only what the caller changed moves to
/config/list, which still reports stored_in_db off the row, and the field/info
call now asserts the ownership the endpoint reports: the config file owns the
key, so it reads back as source=config and editable=false.
Verified against a live proxy on an isolated Postgres rather than in CI, where
this check has never run: it waits on protected-environment approval.
_apply_general_settings_side_effects grew a fourth argument when the reload
started comparing the resolved pass-through list, and this dispatch test calls
it positionally, so it failed with a TypeError.
The reload only re-registered pass-through endpoints when the stored row
still carried the key, so deleting the row left the deleted routes serving
traffic until the process restarted.
It now compares the resolved list before and after the row is applied and
rebuilds on any difference, including a deletion that resolves back to the
config file's list or to nothing.
This matches what _apply_retention_settings already does with the retention
values, so the two reload effects no longer disagree about what counts as a
change.
The tests assert the proxy's registry of live pass-through routes, which is
what decides whether a request is routed upstream or falls through to the
auth error, rather than that the registration helper was called.
The two dashboard toggles under litellm_settings wrote through save_config,
so the refusal applied, but they mutated the litellm module global first: a
refused write still took effect in the running process until the next reload.
Both now check before they mutate.
/config/field/delete drops the stored key without touching the store, so a
deleted key kept reading back from the process. It now refreshes the store
like the other write paths.
/config/list reported source and editable for the general_settings rows but
not for the litellm_settings ones, so the dashboard would have shown a
config-declared toggle as editable.
Both write paths now go through the same refusal, so /config/field/update and
/config/update answer identically instead of each phrasing its own rule.
A successful write now applies to the SettingsStore, so the next read sees it.
Without this, /config/field/info reported a key the dashboard had just stored
as "not set" until the process reloaded from the database.
resolve() no longer takes a KeyRule it never reads; the store picks the row.
The matrix tests resolve through SettingsStore instead of calling resolve
directly, so the section and key in each case actually route a lookup.
ConfigFieldInfo and ConfigList type `source` as the FieldSource literal, and
the dashboard API types are regenerated for the two new fields.
The precedence used to vary per key: some keys let a stored row win, some
let the file win, some merged the two. That meant an operator could not
answer "which value is live?" without knowing the key.
Now file presence decides ownership. A key the config file declares is
config-owned, whatever the database holds, and a key the file omits falls
back to the stored row. KeyRule no longer carries a RuleKind, only which
row the stored value lives in.
Writes to a config-owned key are refused at the two surfaces that reach
the database instead of being stored and silently ignored: save_config
and /config/field/update both 400 naming the key and the config file path.
Both read endpoints now report source and editable off the same
SettingsStore, so /config/field/info and /config/list can no longer
disagree inside one process.
Replaces the 786-case checked-in JSON fixture with cases generated from
the rule table, so the matrix tests no longer assert that resolve() agrees
with a snapshot of resolve().
BREAKING CHANGE: a dashboard or /config/field/update write to a setting
the config file declares now returns 400 instead of being stored. Remove
the key from the config file to let the database own it.
OCR transformations, BaseOcrConfig with its response and connection types,
the OCR error, and the HTTP pieces (custom_httpx: http_handler, transport,
media, llm_http_handler with OcrClient and the request/response handler)
now live in litellm-llms at their Python paths. Provider code no longer
reaches into the route: it gets the caller's hooks through a route-neutral
CallHooks trait that core implements over its host, and core dispatches to
llm_http_handler::ocr with the concrete config, the way Python calls
base_llm_http_handler.ocr(provider_config=...).
Core keeps the route: entrypoint, request types, credential fallback,
provider dispatch, the machine and hook glue. ocr/mod.rs no longer
re-exports anything, provider constants moved next to their only users,
and provider tests that drive the whole route moved to core's route test
files. Twenty-two of those were exact copies of tests already there and
were dropped; every one still runs once.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>