Skip to content

🐛 fix(cache): move locks to private directory - #214

Merged
gaborbernat merged 3 commits into
tox-dev:mainfrom
gaborbernat:security/vgw4gwqt-private-locks
Nov 3, 2026
Merged

gaborbernat merged 3 commits into
tox-dev:mainfrom
gaborbernat:security/vgw4gwqt-private-locks

Conversation

@gaborbernat

@gaborbernat gaborbernat commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

DiskContentStore.locked() placed cache locks in a traversable directory with permissions that let another local account hold an exclusive lock through a read-only descriptor. That account could stall interpreter discovery before a cached entry was read. The lock files now live in a directory accessible only to the cache owner or, for a group-writable cache, its group. This addresses draft advisory ANT-2026-VGW4GWQT.

Readable cache locks could stall discovery

On Linux, flock(2) permits an exclusive lock on a read-only descriptor. The previous FileLock call used a lock file next to the cache entry. The new locked() path uses locks-v2 with owner-only access by default. It allows group writes when the cache directory is group-writable and the umask permits them. Existing lock files at the old path are ignored, including locks already held on them.

Behavior changes

POSIX cache locks use the new directory. Group-writable caches retain group coordination under a group-permissive umask. Windows keeps its existing lock path. Processes running this and an older release against the same cache do not coordinate writes; use separate cache roots while both run, as the cache documentation describes.

Reported by Antigravity: ANT-2026-VGW4GWQT.

Another account can hold a readable cache lock without write access and
block interpreter discovery. Put new POSIX locks in an owner-only directory
and retain group access when the cache directory is group writable. New
processes no longer wait on lock files opened by older releases.
@gaborbernat gaborbernat added the bug Something isn't working label Nov 3, 2026
@gaborbernat gaborbernat added the security Security fixes and advisories label Nov 3, 2026
@gaborbernat
gaborbernat merged commit 320fb4a into tox-dev:main Nov 3, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working security Security fixes and advisories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant