You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
hooks: a dangling .zero junction can disable beforeTool blocking on Windows #1219
main at 17fcd26602dc685fd1596739c4d718932d856d9e; found while reviewing #1211.
OS and environment
Windows 10/11, cmd.exe; junction created with mklink /J (no symlink privilege needed).
Steps to reproduce
Create a workspace directory with a .zero junction pointing at a target directory.
Put a valid hooks.json under the target.
Remove the junction target, leaving .zero as a dangling junction.
Load the project hook layer / run a beforeTool hook in that workspace.
Expected behavior
The hook config is known to exist but cannot be resolved, so LoadConfig returns ErrInvalidConfig and beforeTool stays blocked.
Actual behavior
On Windows, os.Lstat reports a junction as ModeIrregular rather than ModeSymlink. danglingSymlinkInPath only checked the symlink bit, so it skipped the dangling .zero junction. LoadConfig returned no error and no diagnostics, and beforeTool ran with no policy.
Relevant logs, screenshots, or error messages
Reproduced on Windows with mklink /J; Lstat returned mode ?rw-rw-rw- with no symlink bit, ReadFile returned not-exist, and LoadConfig returned no error. PR #1211 now checks Lstat existence plus Stat not-exist, which treats any dangling link/junction as invalid, and adds a Windows junction regression test.
Marking this bug and issue-approved. I reproduced the junction case myself while reviewing #1211: a dangling .zero junction made with mklink /J was skipped by the symlink-only check, and the Windows test in that PR fails when the fix is reduced to the symlink bit. #1211 is the fix and is approved from my side.
Activity
Vasanthdev2004 commentedon Nov 20, 2026
Marking this
bugandissue-approved. I reproduced the junction case myself while reviewing #1211: a dangling.zerojunction made withmklink /Jwas skipped by the symlink-only check, and the Windows test in that PR fails when the fix is reduced to the symlink bit. #1211 is the fix and is approved from my side.