Repository navigation
fix: harden lock contention and permission verification - #101
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 2, 2026, 7:01 PM ET / 23:01 UTC. ClawSweeper reviewWhat this changesThe PR hardens sidecar-lock contention handling and Windows permission verification, adding bounded identity-checked reads, stale-reclaim fixes, and regression/stress coverage. Merge readiness⛔ Blocked until stronger real behavior proof is added - 4 items remain Keep this PR open for a focused repair: the synchronous sidecar snapshot path can still block indefinitely if an attacker swaps a checked regular sidecar for a FIFO before Priority: P1 Review scores
Verification
How this fits togetherFile-lock APIs protect filesystem-backed state with a sidecar lock file. A contending caller inspects that attacker-controlled sidecar, validates its type and identity, applies stale-lock policy, then either acquires the lock or reports a bounded failure. flowchart LR
A[Caller requests file lock] --> B[Sidecar lock manager]
B --> C[Inspect lock pathname]
C --> D[Open sidecar descriptor]
D --> E{Regular file and same identity?}
E -->|yes| F[Parse bounded payload]
E -->|no| G[Fail or retry safely]
F --> H[Stale and reclaim decision]
H --> I[Acquire or report lock result]
Before merge
Findings
Agent review detailsSecurityNeeds attention: The branch improves several identity fences but leaves a synchronous attacker-controlled FIFO race that can deny service. Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Mirror the async reader’s nonblocking descriptor-open protection in the synchronous sidecar reader, retain no-follow and identity checks, and add a deterministic regular-file-to-FIFO swap regression that proves synchronous acquisition returns within its retry/timeout boundary. Do we have a high-confidence way to reproduce the issue? Yes, from source: replace a regular contended lock sidecar with a FIFO after Is this the best way to solve the issue? No: the branch correctly applies a nonblocking open in the asynchronous snapshot reader but omits it from synchronous inspection, leaving the claimed bounded sidecar handling incomplete. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 209fbd1cfb9e. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
Acceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Empty icacls output was accepted as verified ACL data. Sidecar inspection could follow a pathname swapped to a symlink, and both async and sync sidecar reads were unbounded. Foreign synchronous .reclaim guards could be deleted after mkdir reported EEXIST. An old mtime overrode a valid future createdAt, falsely marking live locks stale. Sync acquisition spun forever on dangling-symlink sidecars, ignoring timeoutMs: 0. Every lock-manager domain permanently added another exit listener.
194be00 to
67297bd
Compare
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix: harden lock contention and permission verification This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
Summary
EPERMbudget coveredFindings fixed
.reclaimdirectory aftermkdirreturnedEEXISTicaclsoutput was classified as verifiedwindows-aclwith permissive factsmtimeoverrode a valid futurecreatedAt, falsely marking a lock staleVerification
pnpm check(699 passed, 34 skipped)pnpm test:security(64 passed)git diff --check--mode local): clean, no accepted/actionable findingsHost verification ran on macOS/APFS. Windows-only denial cases remain explicitly gated and now cover the exact eight-retry budget and descriptor-based snapshot read.