Skip to content

Fix single-file git path confinement - #683

Draft
cursor[bot] wants to merge 1 commit into
developfrom
cm/critical-bug-investigation-fad6
Draft

Fix single-file git path confinement#683
cursor[bot] wants to merge 1 commit into
developfrom
cm/critical-bug-investigation-fad6

Conversation

@cursor

@cursor cursor Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes a critical path confinement bug in single-file git operations:

  • Reject absolute, empty, and parent-traversing filenames before commitFile / discardFile mutate git state or the worktree.
  • Reject existing paths whose parent resolves outside the repository, covering symlink-directory escapes.
  • Restore tracked files with git2 exact-path matching instead of pathspec matching.
  • Add regression tests for absolute path deletion, .. traversal, symlink-directory escapes, and the valid repo-relative untracked discard path.

Test Plan

  • cargo +stable test -p nixmac git::exec::tests -- --nocapture
  • cargo +stable test -p nixmac

Docs

10|
  • No docs update needed
Open in Web View Automation 

Co-authored-by: cooper <czxtm@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant