Repository navigation
🐛 fix(strict): protect sentinel and claims - #985
Merged
Merged
Conversation
A group-writable strict sentinel let another account change its record, so a soft contender could enter beside the strict holder. Remove group and other write permission when creating strict records. Treat a refused hard-link probe as an existing claim so cross-account contenders wait.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
StrictSoftFileLockcreated its sentinel and claims with the requested mode. A shared group could therefore change the sentinel record, allowing aSoftFileLockcontender to enter while the strict holder remained inside. Strict record creation now removes group and other write permission. This addresses draft advisory ANT-2026-IHP04UFY.The sentinel must remain owned by its writer
The mode argument and umask determine a new file's permissions; a default ACL can also grant access within the mode's limit. Previously, a requested mode with group write could leave the sentinel writable by another account. A legacy soft contender trusts that sentinel's content to decide whether to wait. The new creation mode prevents another account from changing that decision through a newly created record.
sequenceDiagram participant S as strict holder participant M as sentinel participant P as peer account participant C as soft contender rect rgb(255, 214, 214) S->>+M: old: publish a group-writable sentinel P->>M: change its record C->>M: read changed record M-->>C: appears stale, contender enters deactivate M end rect rgb(216, 243, 220) S->>+M: new: publish sentinel without group or other write P->>M: write denied C->>M: read intact sentinel M-->>C: wait for strict holder deactivate M endClaim probes after the mode change
A strict contender verifies a claim with a hard-link probe. Linux can refuse a hard link to another account's file once the claim is no longer group-writable.
_claim_exists_on_servernow counts thatEPERMas an existing claim, so a contender waits instead of raising a protocol error. A missing claim still returns false onENOENTorESTALE.Behavior changes
New strict sentinels and claims omit group and other write bits even when
mode, umask, or a default ACL would permit them. Existing records keep their permissions; an owner can remove those bits withchmod go-wbefore reusing the path. On Linux with protected hard links, a cross-account strict contender can treatEPERMfrom the claim probe as contention. No caller-facing exception is added.Reported by the filelock scanner: ANT-2026-IHP04UFY.