Skip to content

fix(desktop): harden the git calls behind the status bar - #24

Merged
arifintahu merged 1 commit into
mainfrom
fix/git-status-hardening
Oct 28, 2026
Merged

arifintahu merged 1 commit into
mainfrom
fix/git-status-hardening

Conversation

@arifintahu

Copy link
Copy Markdown
Member

What and why

The status bar ran git in the folder the shell reports via OSC 7, which any program output can forge. Now:

  • UNC/network paths and non-folders are refused before git starts (a network path makes Windows start SMB auth and leak the NTLM hash)
  • git runs with -c core.fsmonitor=false, --no-optional-locks, GIT_OPTIONAL_LOCKS=0 and GIT_TERMINAL_PROMPT=0, so repo config cannot run a program through the fsmonitor hook and git does not write to the repo or prompt

The git helpers moved from ipc.rs to a new git.rs.

Fixes #17

How you checked it

  • Tests first for safe_cwd (network, missing, file, valid folder) and the command's args/env.
  • cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo test pass (91 tests).
  • Ran the same git flags against this repo: branch and diff --shortstat still work.
  • Not tested: a real malicious core.fsmonitor repo or a live UNC share.

@arifintahu arifintahu self-assigned this Oct 28, 2026
@arifintahu
arifintahu merged commit 6b4c45b into main Oct 28, 2026
@arifintahu
arifintahu deleted the fix/git-status-hardening branch October 28, 2026 12:53
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.

fix(desktop): git status runs in a folder taken from terminal output (OSC 7)

1 participant