filelock: WindowsFileLock ignores mode: a 0o600 lock file and the ReadWriteLock database inherit the directory ACL
Affected packages
| Ecosystem | Package | Affected | Fixed |
|---|---|---|---|
| pip | filelock |
< 4.2.1 |
4.2.1 |
| PyPI | filelock |
≥ 3.10.0, < 4.2.1 |
4.2.1 |
Original description The description as published by the source.
filelock on Windows ignores the mode argument. FileLock(path, mode=0o600) creates the same file as FileLock(path): one with no security descriptor of its own (the Windows record that says who may access a file). Its access list, or ACL, is whatever the lock directory hands down to new files. filelock creates the ReadWriteLock database, which it asks to be 0o600, the same way. In a directory whose inheritable ACL grants other local accounts access to new files, those accounts can open the lock file or database. They can take the byte-range lock (a lock on a span of bytes in a file) once the owner releases it and keep the owner's later acquire() calls waiting or timing out. They can read holder metadata an on_acquired hook left in a preserve_lock_file=True file. Where the directory hands down modify access, they can write to both files.
lock.mode still reports 0o600. The documentation neither promises an ACL on Windows nor says that Windows drops the mode. On Unix the same mode keeps other accounts out. Mutual exclusion between processes that follow the protocol holds on either platform. Affected versions are filelock 3.10.0 through 4.2.0 on Windows.
Anthropic's OSS Scanner reported this in private. Finding covered by this advisory:
ANT-2026-0KEO0DDO[medium, CWE-732]: WindowsFileLock ignores mode; 0o600 lock files inherit the directory ACL.
Severity
CVSS 3.1 CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L scores 5.3 (Medium).
AV:L (local):…
Source: GitHub Security Advisories (Global) NVD GitHub Advisory
References
- package github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com