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.
lane: require verified managed-worktree identity before TTL cleanup (#5824) #5854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lane: require verified managed-worktree identity before TTL cleanup (#5824) #5854
Changes from all commits
a025713File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor/non-blocking:
is_managed_worktreeis (correctly) re-checked right before thefs::remove_dir_allfallback (line 135), but not right before the primarygit worktree remove --forcecall (line 125-134). There's still a small TOCTOU window between the check at line 116 and thatCommand::new("git")invocation where the path could theoretically be swapped. In practice this relies on git's own worktree-remove path validation as a second layer, and the realistic threat here is a stale/malformed record (which this PR fixes), not an active local attacker racing the filesystem — so I wouldn't block on it, just flagging for awareness given the "verified identity" framing in the PR title.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[INFO] Registrations directory should be canonicalized before prefix comparison
registrations is built as repo_root.join(".git").join("worktrees"), where only repo_root is canonicalized. If .git is a symlink or a separate gitdir, canonicalized registration paths may not start with the non-canonical registrations prefix, causing valid linked worktrees to be rejected. This is a false negative, not data loss.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Canonicalize the registrations directory before the starts_with check so symlinked .git directories or separate gitdirs do not cause false negatives.
Uh oh!
There was an error while loading. Please reload this page.