Repository navigation
WIP: fix/winx4-rootaudit - #1390
Merged
Merged
Conversation
…d boundary (#1364) Enclave rule (#1364 ruling): a bare "/" names the payload (shell) root uniformly across the command set. mktemp folded only the drive dialect in its own normalize_win_shell_path and passed every other spelling to GetFullPathNameW downstream, so `mktemp -p /` created its file in the current drive root -- a sandbox leak. run() now folds the directory side of the template (the -p dir, and the template's own directory part) through native_path::normalize_api_operand after the local drive fold, so shell-namespace spellings resolve through the shell tree exactly like every other command. Drive spellings and native paths pass through unchanged. Regression: mktemp_dash_p_bare_slash_uses_shell_root_issue1364 sets WINUXSH_ROOT to a scratch payload root and asserts the created file lands inside it.
…1364) absolute_path() absolutized the walk root with GetFullPathNameW alone, so `updatedb -d /` (and --localpaths=/ ) walked the current drive root and stored drive paths in the database instead of walking the payload (shell) root -- a sandbox leak under the #1364 enclave rule. The root now passes through native_path::normalize_api_operand before absolutizing; drive spellings still fold to their drive root inside the boundary, native and relative roots are unchanged. Regression: updatedb_bare_slash_walks_shell_root_issue1364 plants a marker file in a scratch shell root and asserts `updatedb -d /` records it.
…erand boundary (#1364) cygpath had no shell-root awareness at all: unix_to_windows merely replaced separators, so `cygpath -w /` printed "\\" (which every consumer roots on the current drive) and `-a` absolutized onto the current drive. Under the #1364 enclave rule the bare "/" names the payload (shell) root, and cygpath -- the spelling converter -- must agree with the resolution every other command applies. unix_to_windows now folds a "/"-initial spelling through native_path::normalize_api_operand first and adopts the result when it arrives as a native drive path. Drive spellings fold inside the boundary to the same drive roots as before (pinned), pseudo-devices and non-shell spellings pass through untouched, and standalone behaviour without a configured shell root is unchanged. Regression: shell_root_bare_slash_converts_to_payload_root_issue1364 asserts `cygpath -w /` prints the configured payload root while `cygpath -w /c` still prints the C: drive root.
…tat (#1364) load_file_system_stat ran std::filesystem::absolute on the raw operand first, rooting a shell spelling ("/") on the current drive, and only then passed it through the operand boundary -- so with the cwd on a different drive than the payload root, the filesystem fields (%m mount point, volume serial, free space) described the cwd's volume instead of the operand's. The operand now goes through make_api_path_operand_w first (wide form, no ANSI-codepage detour) and absolutizing applies to the normalized spelling; relative operands still join the cwd exactly as before. No unit test: the divergence is only observable across volumes, which the single-volume CI cannot stage; it is pinned by this cluster's Wine probes (payload on Z:, cwd on C:, `stat -c %m /` must report the Z: volume).
…boundary (#1364) read_db opened the -d database path with a raw CreateFileW on the as-typed spelling, so a database spelled from the shell root (`locate -d /ra.db`) was looked up on the current drive root instead of the payload (shell) root. The path now goes through make_api_path_operand and the file is opened via its extended spelling; relative and native database paths resolve exactly as before. Regression: locate_database_path_uses_shell_root_issue1364 plants the database in a scratch shell root and reads it back via the /ra.db spelling from a different cwd.
caomengxuan666
force-pushed
the
fix/winx4-rootaudit
branch
from
October 26, 2026 22:15
efd4b49 to
873d1c0
Compare
caomengxuan666
marked this pull request as ready for review
October 26, 2026 22:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1364
Cluster: winx4-rootaudit — full-command-set audit of bare
/resolution (176 commands), under the maintainer's enclave ruling (2026-10-26): bare/= the payload root (WINUXSH_ROOT) uniformly for all internal commands; drive roots are reached only via/c/-style spellings. (This supersedes the issue's original drive-root-alignment expectation.)Five commands leaked bare
/to the current drive root; each now folds operands through the shared native_path operand boundary:mktemp: template directory resolved through the shared operand boundaryupdatedb: walk roots folded through the shared operand boundarycygpath: shell-namespace spellings converted through the shared operand boundarystat: operand folded before absolutizing inload_file_system_statlocate:-ddatabase path resolved through the shared operand boundaryVerification (winx window successor, 2026-10-26): mingw+Wine probe battery, 16 assertions — 14 PASS / 2 adjudicated (full log: cluster
rootaudit-probes.log):cygpath -w /→ payload root,cygpath -w /c→C:\;mktemp -p /created its file inside the payload root (artifact checked on disk);updatedb --localpaths=/walked the payload root and its database landed payload-side;stat -c %m /reports the operand's volume (Z:-side, from a C: cwd — the cross-volume bug this fix targets), and/ccells return exactlyC:\.ls /lists the payload root,ls /c+ls /c/reach the drive root,find /,tree /,test -d /,test -epayload marker,cat /is-a-directory error.stat-mount-payload-volume(literal FAIL, substance PASS): output was\\?\Z:\tmp\instead of a bareZ:— Wine's mount table reports its temp-dir mount with a\\?\prefix; the operand-volume logic itself is proven by the/ccells and the Z-vs-C cross-volume direction. Expected to readZ:\under real Windows volume APIs.realpath-slash-payload(FAIL, expectation dispute — realpath is audit class C, not one of the five fixes):realpath /prints/, the shell-namespace canonical spelling, rather than disclosing the host-side payload path likecygpath -w. Recorded as a residual question in the window report; it shows no out-of-enclave resolution.locatehas no harness vehicle by cluster design; its coverage is the unit tests in this PR (Windows CI).Residual audit items beyond these five commands are tracked in #1385.