Repository navigation
Clear setgid when hardening Windows VM mount sources - #13750
dhiasalhiQ wants to merge 2 commits into
Conversation
The dockurr/windows container sets setgid on an empty /shared. GNU chmod keeps a directory's setgid bit for a four-digit octal mode, so chmod 0700 left ~/Windows at 2700, and the exact 700 check then refused every launch. A five-digit mode clears it. Fixes omacom#13558 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tested commit Verification Summary
Test details$ bash test/shell.d/windows-vm-compose-test.sh
ok - writer emits fixed anchors bound to exact private source inodes
ok - hardening clears the setgid bit the container leaves on the shared source
ok - input cannot inject a host path or compose field
ok - password with quote, backslash, and dollar round-trips
ok - privileged action dispatch is allowlisted
ok - pkexec target is only the canonical packaged regular file, never a PATH symlink
...
ok - disk-space checks follow the storage symlink target
$ git diff --check
$ bash -n bin/omarchy-windows-vm test/shell.d/windows-vm-compose-test.sh
|
The case ran prepare_user_mount_sources before the privileged writer, so the user-side chmod cleared setgid first and the privileged one in prepare_caller_mounts could be reverted without the test noticing. Let the writer meet the 2777 source itself, then check the user-side hardening separately. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Codex Medium <noreply@openai.com>
|
Reviewed and verified on a disposable Omarchy worker (coreutils 9.11). The fix is right:
I pushed one test-only commit, a27373c. The case called The second opinion, Codex at medium effort, reviewed the final head and found nothing. It raised the test gap above in an earlier round. Comparing this with #13800 and #14093, which fix the same bug, it also preferred this one, as I did. Independence is not guaranteed. #13800 reaches the same modes with a second One thing outside this PR keeps it from being marked ready. |
|
|
Closing this alternative after #12323 merged into Scope checked by GPT-6 in Codex and Codex Medium against the discussion and landed change; review independence is not guaranteed. No tests were rerun for this cleanup. Omabot on behalf of DHH |
The dockurr/windows container runs
chmod 2777 /sharedon an empty share, which lands on~/Windows. For directories, GNU chmod keeps setuid/setgid when given a 3 or 4 digit octal mode, sochmod 0700left it at2700.mounted_leaf_matchesand the post-chmod check inprepare_caller_mountsrequire exactly700, so every later launch failed with the generic "Failed to start Windows VM!".This uses
chmod 00700in the two places that harden the mount sources. The five-digit mode is the documented way to clear those bits numerically. It adds a case towindows-vm-compose-test.shthat starts from a2777share and checks that it ends up at700and still verifies.I couldn't run
windows-vm-compose-test.shmyself: it needs unprivileged mount namespaces, and I only had a Windows machine.bash -npasses on both files.Fixes #13558
🤖 Generated with Claude Code