[PR #12149] Manually replace unqualified cmd, powershell paths for the default profiles #28880

Open
opened 2026-01-31 09:31:22 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/12149

State: closed
Merged: Yes


In previous releases, we had the commandlines for the Command Prompt and PowerShell profiles unqualified, as cmd.exe and powershell.exe. This was bad - theoretically, that would have preferred the cmd that was in the CWD over the one in System32. Or, something could insert itself into the path, and you'd end up with a malicious cmd.exe before the real one.

In #11437, we made sure that the userDefaults are initiated with the fully qualified paths. However, that didn't fix the issue for folks who already had settings files.

In an effort to better prevent this kind of badness, if we see a profile with a default profile guid, AND the unqualified version of the path, then we'll stealth replace it with the fully qualified one.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/12149 **State:** closed **Merged:** Yes --- In previous releases, we had the commandlines for the Command Prompt and PowerShell profiles unqualified, as `cmd.exe` and `powershell.exe`. This was bad - theoretically, that would have preferred the cmd that was in the CWD over the one in System32. Or, something could insert itself into the path, and you'd end up with a malicious `cmd.exe` before the real one. In #11437, we made sure that the `userDefaults` are initiated with the fully qualified paths. However, that didn't fix the issue for folks who already had settings files. In an effort to better prevent this kind of badness, if we see a profile _with a default profile guid_, AND the unqualified version of the path, then we'll stealth replace it with the fully qualified one. * Related to #11437 * [x] fixes #12126 * [x] Tests added
claunia added the pull-request label 2026-01-31 09:31:22 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#28880