[P1] base shell starts inside the writable host working directory

#21 · closed · 1 comments

View on GitHub ↗

Azathothas

Tested the published **wsl-toolkit-v1.3.0 Windows amd64** binary on Windows 11/WSL2 on 2026-09-10. SHA-256: `71b2ef9b0cf50da0acda45e7cc9293185a2b18d8aa403812e20ed29222d54424`, matching the release manifest. Related: #6. ## Summary `base shell` and `base shell --root` start in the caller's Windows working directory mounted under `/mnt/c`, not in the distro user's home. The root shell can therefore modify/delete the host checkout. The manual's warning says root is “inside the distribution” and “not on this machine,” which gives the opposite safety impression. ## Reproduction From the repository directory: ```powershell Set-Location C:\Users\AjamX\Downloads\ToolKit & $wtk base shell & $wtk base shell --root ``` Inside both shells: ```sh pwd findmnt -T . test -w .; echo $? ``` Observed: `pwd` was `/mnt/c/Users/AjamX/Downloads/ToolKit`; `findmnt` identified `/mnt/c` as a writable 9p/drvfs mount; the directory was writable. I did not mutate the repository. This does not affect isolated `run` containers, which correctly receive a copied workspace and no host mount. It affects the explicitly offered base shell. ## Cause The shell implementation invokes `wsl.exe -d <base> -u <user>` without `--cd` or a guest-side `cd`. WSL inherits/translates the host current directory. ## Expected Default to the selected guest user's home (for example `--cd ~`) or make host-cwd attachment an explicit opt-in. The root warning must state plainly whenever Windows drives are mounted and writable. Add an acceptance assertion that a shell launched from a host checkout does not begin inside that checkout by default.

Comments

Azathothas

Fixed in `wsl-toolkit-v2.0.0`, by `WSL-47` in `TODO/wsl-toolkit-go.md`. `base shell` starts in the guest account's home. `--here` is the old behaviour, under a flag, and it says what it did. Re-derived against the published v2.0.0 binary from the repository directory, 2026-09-10: ```text $ printf 'pwd\n' | wsl-toolkit base shell /home/toolkit $ printf 'pwd\n' | wsl-toolkit base shell --here /mnt/c/Users/AjamX/Downloads/ToolKit ``` The second half of the report was the manual, and it was the more important half: it said root was "inside the distribution" and "not on this machine", which is an isolation this shell does not have whatever directory it starts in. The warning names what is actually reachable now: ```text root here is root INSIDE wsl-toolkit and not on this machine, AND these Windows drives are mounted and writable: /mnt/c /mnt/d /mnt/f /mnt/l /mnt/m /mnt/p /mnt/r /mnt/t /mnt/y ```