Skip to content

build: allow filelock 4.x (lift the <4.0 cap) - #48635

Closed
fas89 wants to merge 1 commit into
BerriAI:mainfrom
fas89:build/lift-filelock-cap
Closed

fas89 wants to merge 1 commit into
BerriAI:mainfrom
fas89:build/lift-filelock-cap

Conversation

@fas89

@fas89 fas89 commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Closes the ask in #48394.

Why

filelock>=3.16.1,<4.0 permits only the 3.x line, and CVE-2026-112940, CVE-2026-112913 and CVE-2026-112907 are fixed only in 4.2.1+. Because litellm is a base dependency for a lot of projects, that cap holds every one of them on a vulnerable filelock with no way out — pip has no override mechanism, so a downstream asking for the fixed version just gets ResolutionImpossible.

Why it's safe

litellm uses two things from filelock, in litellm/proxy/client/cli/commands/configure_profiles.py and litellm/proxy/client/cli/commands/claude_settings.py:

FileLock(str(path), timeout=10, mode=0o600)
from filelock import FileLock, Timeout

On filelock 4.2.4 both timeout and mode are still parameters of FileLock.__init__, Timeout is still exported, and that exact call shape runs. The three CVEs are in the SQLite-backed ReadWriteLock / AsyncReadWriteLock, which doesn't appear anywhere in the tree.

Why <5 and not a floor bump

litellm's requires-python is >=3.10, <3.16, and filelock 4.x requires >=3.11. Widening the cap rather than raising the floor means 3.11+ resolves 4.x while 3.10 keeps a 3.x filelock automatically, through filelock's own requires_python — so nothing breaks for 3.10 users and the lock file stays resolvable on every supported version.

For precedent, probityai/probity#139 shipped this as a uv override (merged, with the same conclusion about the two call sites) because they couldn't wait for the cap to move. virtualenv already allows filelock<5.

I haven't touched the lock file — happy to regenerate it, add a test, or scope this differently if you'd prefer.

filelock 3.x is the only line the current cap permits, and three CVEs
(CVE-2026-112940, CVE-2026-112913, CVE-2026-112907) are fixed only in
4.2.1+. The cap means every downstream that depends on litellm is held
on a vulnerable filelock with no way out, since pip has no override.

litellm uses FileLock(path, timeout=..., mode=...) and Timeout, in
litellm/proxy/client/cli/commands/configure_profiles.py and
claude_settings.py. Both keyword arguments still exist in 4.2.4 and
Timeout is still exported, so the two call sites are unaffected. The
CVEs are in the SQLite-backed ReadWriteLock / AsyncReadWriteLock, which
litellm does not use.

<5 rather than a floor bump because litellm supports Python 3.10 and
filelock 4.x requires >=3.11: widening the cap lets 3.11+ resolve 4.x
while 3.10 keeps a 3.x filelock automatically, through filelock's own
requires_python.
@codecov

codecov Bot commented Oct 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed

codspeed Bot commented Oct 27, 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 fas89:build/lift-filelock-cap (252b962) with main (c7c895d)

Open in CodSpeed

@fas89
fas89 force-pushed the build/lift-filelock-cap branch from f405f1c to 252b962 Compare October 28, 2026 05:51
@fas89

fas89 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Dropped the uv.lock commit I'd just pushed — it can't work from a fork. The guard-fork-dependencies job rejects any uv.lock change in a fork PR, but uv lock --check wants the lockfile in sync with pyproject.toml, so a fork PR that widens a dependency bound trips one gate or the other no matter which way round I do it. Left just the pyproject.toml line here.

If you want to pick it up, the lockfile side is one line — in the litellm requires-dist block, { name = "filelock", specifier = ">=3.16.1,<4.0" } becomes >=3.16.1,<5. Nothing else moves: filelock stays at 3.32.7, which already satisfies the wider bound.

One gotcha if you regenerate it rather than hand-edit. uv 0.10.9, the version pinned in test-linting.yml, writes revision = 3 and rewrites ~210 lines of dependency markers; uv 0.13.6 keeps revision = 5 and gives you just that one line. The 0.10.9 checker reads a revision-5 lockfile fine, it just can't write one.

Two other things from poking at the run: osv-scan is failing on main as well (last five runs there), so that's not from this change. And your osv-scanner config already ignores the filelock advisory with a note to bump filelock once possible — 4.x needs Python 3.11+, so with the universal lockfile 3.10 still resolves to 3.x and the floor stays intact.

christianlouis added a commit to christianlouis/DocuElevate that referenced this pull request Oct 29, 2026
The 0.189.0 release is blocked by the dependency audit because filelock
3.20.3 is affected by CVE-2026-112909 and CVE-2026-112910. Require
filelock 4.2.1 or newer and temporarily constrain LiteLLM to its
compatible 1.103 release line. LiteLLM 1.104.0 through the current
1.106.6 declare filelock<4; upstream compatibility work is tracked at
BerriAI/litellm#48635.

Validation: full pip dry-run resolution succeeded with LiteLLM 1.103.10
and filelock 4.2.4. The 84 AI-provider tests passed in the existing
local environment (LiteLLM 1.103.2/filelock 4.0.9); CI validates a fresh
dependency installation. The repository Ruff helper and git diff --check
passed. No scanner exceptions were added.

Co-authored-by: Christian Krakau-Louis <christian@Christians-Mac-mini-4681.local>
@tin-berri tin-berri closed this Oct 30, 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.

2 participants