Skip to content

fix(guardrails): skip Git-for-Windows usertemp /tmp; judge curl/wget dests (#4251) - #4854

Merged
cursor[bot] merged 3 commits into
mainfrom
cursor/4251-drive-tmp-mount-curl-37e9
Sep 28, 2026
Merged

cursor[bot] merged 3 commits into
mainfrom
cursor/4251-drive-tmp-mount-curl-37e9

Conversation

@kyle-sexton

Copy link
Copy Markdown
Contributor

Closes #4251

Summary

block-windows-drive-tmp no longer treats Git for Windows' usertemp /tmp (the %TEMP% mount) as a drive-root write, and it now judges curl -o / wget -O destinations the same way as mkdir/cp.

Fix

  • One cached probe per hook process: when cygpath -w /tmp matches %TEMP%/%TMP%, or the mount line for /tmp carries usertemp, the Bash command lane skips the POSIX /tmp arm. /c/tmp, C:\tmp, drive-root \tmp, PowerShell /tmp, and the Write/Edit file-path lane stay blocked. Linux CI /tmp tmpfs has no usertemp flag, so existing OSTYPE=msys fixtures still deny.
  • A dest-flag walker reads curl/wget -o/--output and -O/--output-document (space, =, and glued -oFILE). A URL that merely contains /tmp is not a write target.

Verification

cd plugins/guardrails/hooks
bash block-windows-drive-tmp.test.sh

Pins mkdir -p /tmp/x allowed under a Git-for-Windows usertemp stub (cygpath -w /tmp → %TEMP%), /c/tmp still blocked, PowerShell /tmp still blocked, Write /tmp still blocked, and curl -o / wget -O destinations judged (including glued -o/tmp/x).

guardrails 0.39.2 (serialized above origin/main 0.38.13 and in-flight 0.39.1 on #4252).

Open in Web Open in Cursor 

cursoragent and others added 2 commits September 28, 2026 03:26
…dests (#4251)

On a stock Git for Windows install /tmp is a usertemp mount of %TEMP%, so
blocking Bash-tool writes there was a false positive. Skip that spelling
on the Bash command lane when cygpath or the mount table says so.
/c/tmp, C:\tmp, PowerShell /tmp, and the file-path lane stay blocked.
curl -o/--output and wget -O/--output-document destinations are judged
the same way as cp/mv.

Co-authored-by: Kyle Sexton <kyle-sexton@users.noreply.github.com>
… probe

Version sits above in-flight 0.39.1 (#4252). The usertemp probe lives once,
ahead of the matchers. The cygpath stub uses the <user> placeholder so the
machine-specific-paths gate stays quiet.

Co-authored-by: Kyle Sexton <kyle-sexton@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

PR body contract — issue linkage

This PR body does not yet satisfy the issue-linkage contract:

  • Missing a "## Related" section. List related PRs, ADRs, or decision-log entries this PR does not close.

Edit the body and this comment updates itself on the next run.

Shellcheck wants an explicit fallthrough arm, and the portability gate
flags the angle brackets that are character-class literals.

Co-authored-by: Kyle Sexton <kyle-sexton@users.noreply.github.com>
@cursor
cursor Bot marked this pull request as ready for review September 28, 2026 03:42
@cursor
cursor Bot merged commit eb9b70b into main Sep 28, 2026
19 checks passed
@cursor
cursor Bot deleted the cursor/4251-drive-tmp-mount-curl-37e9 branch September 28, 2026 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

guardrails: block-windows-drive-tmp blocks correct /tmp writes on Git for Windows and misses downloader targets

2 participants