fix(windows): resolve ERROR_UNTRUSTED_MOUNT_POINT (448) for junction and symlink working directories#9306
Conversation
|
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @OthmanAdi on file. In order for us to review and merge your code, each contributor must visit https://cla.warp.dev to read and agree to our CLA. Once you have done so, please comment |
|
I'm starting a first review of this pull request. You can follow along in the session on Warp. I approved this pull request and requested human review from: @vorporeal, @alokedesai, @zachbai. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR canonicalizes the Windows PTY start directory and USERPROFILE fallback before passing them to CreateProcessW, addressing failures when the configured working directory is a junction, symlink, or other reparse point.
Concerns
- No blocking correctness, error-handling, performance, or security concerns found in the changed lines.
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
|
Hi @OthmanAdi - do you know why your commit is showing up as "unverified"? The fact that the tooltip for it says "This commit is not signed, but one or more authors requires that any commit attributed to them is signed." is concerning. |
|
Hey @vorporeal, thanks for catching that. I didn't have commit signing configured on this machine. Setting it up now and will push signed commits shortly. |
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
…nctions before CreateProcessW The start directory passed as lpCurrentDirectory to CreateProcessW was never canonicalized. When the working directory is or contains a junction point or reparse point, CreateProcessW fails with ERROR_UNTRUSTED_MOUNT_POINT (WinError 448), breaking symlink traversal, pytest, and any tool that resolves through junctions. Resolve by calling dunce::canonicalize on both the configured start_dir and the USERPROFILE fallback before passing them to CreateProcessW. This resolves symlinks, junctions, and reparse points to their actual paths. The dunce crate is already used for the same purpose elsewhere in the codebase (working_directories.rs, available_shells.rs, standardized_path.rs). Closes warpdotdev#9044
492de77 to
0242c1b
Compare
Description
Fixes #9044
On Windows, when the configured working directory (or its fallback,
USERPROFILE) contains or is a junction point or reparse point,CreateProcessWfails with ERROR_UNTRUSTED_MOUNT_POINT (WinError 448). This breaks symlink traversal for the shell and all child processes, includingGet-ChildItem,pytest, and any tool that resolves through junctions.The same commands work correctly in Windows Terminal and standalone PowerShell because they pass canonicalized paths to
CreateProcessW.Root cause: In
app/src/terminal/local_tty/windows/mod.rs(line 176), thestart_diris validated only withis_dir()and then passed directly aslpCurrentDirectorytoCreateProcessWwithout canonicalization. Junction points pass theis_dir()check but fail inside the kernel's path resolution for untrusted mount points.Fix: Call
dunce::canonicalize()on both the configuredstart_dirand theUSERPROFILEfallback before passing them toCreateProcessW. This resolves symlinks, junctions, and reparse points to their actual paths, eliminating the 448 error.The
duncecrate is already a dependency in theappcrate and is used for the same purpose inworking_directories.rs(line 745),available_shells.rs(lines 818, 850),standardized_path.rs(line 99), andlogin_item/windows.rs(line 77).What this changes
start_dirpassed raw toCreateProcessWdunce::canonicalize(start_dir)resolves junctions firstUSERPROFILEfallback passed rawUSERPROFILEalso canonicalizedTesting
cargo check -p warppasses cleanNew-Item -ItemType Junction -Path "C:\Users\oasrvadmin\AppData\Local\Temp\warp_test" -Target "C:\Users\oasrvadmin\Documents"CreateProcessWfails with error 448Get-ChildItemworks through the junctionNo new automated tests added because this fix is in the Windows ConPTY spawn path, which requires a running ConPTY session to test. The
dunce::canonicalizefunction itself is well tested upstream.Server API dependencies
Agent Mode
Changelog Entries for Stable
CHANGELOG-BUG-FIX: Fixed OS Error 448 (ERROR_UNTRUSTED_MOUNT_POINT) on Windows when the working directory contains symlink or junction points.