From cd262379ecc04cdfdb7a01d1bb0e94cca08b127e Mon Sep 17 00:00:00 2001 From: 0bsolescence Date: Thu, 3 Sep 2026 12:05:08 -0700 Subject: [PATCH] Clear set-ID bits on Windows VM directories --- bin/omarchy-windows-vm | 2 +- test/shell.d/windows-vm-mount-boundary-test.sh | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/omarchy-windows-vm b/bin/omarchy-windows-vm index f672ed7eee1d..dba9333315aa 100755 --- a/bin/omarchy-windows-vm +++ b/bin/omarchy-windows-vm @@ -580,7 +580,7 @@ prepare_caller_mounts() { # Privacy is an explicit preflight step for both already-pinned sources, not # a side effect halfway through the two-mount transaction. Old umask-022 # installs are hardened together before either Docker-facing anchor changes. - chmod 0700 -- "/proc/$BASHPID/fd/$storage_fd" "/proc/$BASHPID/fd/$shared_fd" || { + chmod a-s,u=rwx,go= -- "/proc/$BASHPID/fd/$storage_fd" "/proc/$BASHPID/fd/$shared_fd" || { exec {storage_fd}<&- exec {shared_fd}<&- return 1 diff --git a/test/shell.d/windows-vm-mount-boundary-test.sh b/test/shell.d/windows-vm-mount-boundary-test.sh index 13623d816456..0b29bc0f4a48 100644 --- a/test/shell.d/windows-vm-mount-boundary-test.sh +++ b/test/shell.d/windows-vm-mount-boundary-test.sh @@ -92,6 +92,9 @@ pass "root dispatch rejects missing/invalid uid, passwd, owner, symlink, and wri mkdir /home/storage-target /home/shared-target mount -t tmpfs -o uid=1000,gid=1000,mode=0755,size=3g storage-test /home/storage-target mount -t tmpfs -o uid=1000,gid=1000,mode=0755,size=64m shared-test /home/shared-target +# dockur/windows can leave the shared directory setgid. Numeric chmod preserves +# directory set-ID bits, so exercise the mode the next launch must normalize. +chmod 2755 /home/shared-target ln -s /home/storage-target /home/alice/.windows ln -s /home/shared-target /home/alice/Windows chown -h 1000:1000 /home/alice/.windows /home/alice/Windows