SECURITY: a grantee writes through the owner's file lock (identity swap in shared folders) #972

Closed
opened 2026-10-19 21:02:17 +00:00 by Cordy · 2 comments
Owner

Found in the batch 4 research (research-b4.md §7.2). Verified on posix and s3.

What happens: anna holds a user lock on /home/anna/proj/a.txt. bob, who has a write grant on that folder, writes to /shared/anna/proj/a.txt and the write is allowed. The reverse also happens: a lock recorded for bob blocks bob's own writes through the grant.

Cause: the same as #915. filelock.Driver.deny (internal/storage/filelock/filelock.go:305-314) compares auth.UserFrom(ctx).Username with the lock owner, and scope has already replaced that user with the owner (scope/shared.go:238-249).

Fix: compare the acting person (the #915 decision D1 (b)). Also check which name the lock API records for a lock taken through /shared.

Planned for batch 4 together with #915, because it is the same change.

Found in the batch 4 research (`research-b4.md` §7.2). Verified on posix and s3. **What happens:** anna holds a user lock on `/home/anna/proj/a.txt`. bob, who has a write grant on that folder, writes to `/shared/anna/proj/a.txt` and the write is **allowed**. The reverse also happens: a lock recorded for bob blocks bob's own writes through the grant. **Cause:** the same as #915. `filelock.Driver.deny` (`internal/storage/filelock/filelock.go:305-314`) compares `auth.UserFrom(ctx).Username` with the lock owner, and scope has already replaced that user with the owner (`scope/shared.go:238-249`). **Fix:** compare the acting person (the #915 decision D1 (b)). Also check which name the lock API records for a lock taken through `/shared`. Planned for batch 4 together with #915, because it is the same change.
Author
Owner

Shipped in v0.6.351 (PR #984), with #915.

Lock checks now compare the person who acted. A grantee can no longer write through the owner's lock, and a grantee's own lock no longer blocks their own saves through the share. This includes a Collabora save through /shared.

Tests: both directions, plus WOPI and WebDAV lock-then-save through /shared and rename through a lock, on posix and s3.

Live check: pending the same two-account check as #915. The new side effect, that a grantee's lock now blocks the owner, is tracked in #978 (decision needed).

**Shipped in v0.6.351 (PR #984), with #915.** Lock checks now compare the person who acted. A grantee can no longer write through the owner's lock, and a grantee's own lock no longer blocks their own saves through the share. This includes a Collabora save through `/shared`. **Tests:** both directions, plus WOPI and WebDAV lock-then-save through `/shared` and rename through a lock, on posix and s3. **Live check:** pending the same two-account check as #915. The new side effect, that a grantee's lock now blocks the owner, is tracked in #978 (decision needed).
Author
Owner

Closing as fixed (v0.6.351): the lock check compares the acting person, not the folder owner (internal/storage/filelock/filelock.go:305-310, verified on v0.6.358 main). The two-account live check stays tracked in #1005 section F.

Closing as fixed (v0.6.351): the lock check compares the acting person, not the folder owner (`internal/storage/filelock/filelock.go:305-310`, verified on v0.6.358 main). The two-account live check stays tracked in #1005 section F.
Cordy closed this issue 2026-10-26 23:43:05 +00:00
Sign in to join this conversation.
No labels
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Cordy/Cairn#972
No description provided.