Two small argument-construction gaps left open by #121. Neither is reachable through normal use; both were found during that PR's review and deliberately parked rather than fixed, to keep the change focused.
1. A distro name beginning with - is not defended against
Documented under WSL Sessions → Known gaps in CLAUDE.md.
ShellSession.QuoteForCmd only wraps a value in quotes when it contains a space, tab or quote, so a distro named --help (or anything starting with -) reaches wsl.exe as a bare token and is parsed as an option rather than as the argument to -d. Distro names come from wsl -l -v, so this needs a user who imported a distro with a hostile name — low likelihood, but the value flows from state.json, which CLAUDE.md treats as untrusted input.
Note that quoting alone does not fix it: wsl.exe -d "-x" still parses as an option. The real fix is either rejecting such names in WslDiscoveryService.Parse or validating in LaunchValidationError, which already guards a blank distro on the same path.
2. GitService.CreateWorktreeAsync still uses naive quoting
GitService.cs:150-152 builds its arguments with plain \"{value}\" interpolation while everything else on the WSL path goes through QuoteForCmd. Since #121 routes git for \wsl$ folders through wsl.exe, that string now reaches one more layer than it used to. Inputs are user-typed branch names and paths rather than persisted state, so this is robustness rather than a security hole — but it is the last caller not using the shared helper, and the asymmetry is the kind that gets copied.
Verify
Unit tests only; both are covered by the existing Win32CommandLineTests round-trip harness, which tokenizes through the real CommandLineToArgvW.
Two small argument-construction gaps left open by #121. Neither is reachable through normal use; both were found during that PR's review and deliberately parked rather than fixed, to keep the change focused.
1. A distro name beginning with
-is not defended againstDocumented under WSL Sessions → Known gaps in
CLAUDE.md.ShellSession.QuoteForCmdonly wraps a value in quotes when it contains a space, tab or quote, so a distro named--help(or anything starting with-) reacheswsl.exeas a bare token and is parsed as an option rather than as the argument to-d. Distro names come fromwsl -l -v, so this needs a user who imported a distro with a hostile name — low likelihood, but the value flows fromstate.json, whichCLAUDE.mdtreats as untrusted input.Note that quoting alone does not fix it:
wsl.exe -d "-x"still parses as an option. The real fix is either rejecting such names inWslDiscoveryService.Parseor validating inLaunchValidationError, which already guards a blank distro on the same path.2.
GitService.CreateWorktreeAsyncstill uses naive quotingGitService.cs:150-152builds its arguments with plain\"{value}\"interpolation while everything else on the WSL path goes throughQuoteForCmd. Since #121 routes git for\wsl$folders throughwsl.exe, that string now reaches one more layer than it used to. Inputs are user-typed branch names and paths rather than persisted state, so this is robustness rather than a security hole — but it is the last caller not using the shared helper, and the asymmetry is the kind that gets copied.Verify
Unit tests only; both are covered by the existing
Win32CommandLineTestsround-trip harness, which tokenizes through the realCommandLineToArgvW.