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

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/12149
Author: @zadjii-msft
Created: 1/12/2022
Status: Merged
Merged: 1/12/2022
Merged by: @undefined

Base: mainHead: dev/migrie/b/12126-correct-old-cmdexe-paths


📝 Commits (3)

📊 Changes

4 files changed (+76 additions, -0 deletions)

View changed files

📝 src/cascadia/LocalTests_SettingsModel/ProfileTests.cpp (+57 -0)
📝 src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp (+1 -0)
📝 src/cascadia/TerminalSettingsModel/CascadiaSettings.h (+1 -0)
📝 src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp (+17 -0)

📄 Description

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/12149 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 1/12/2022 **Status:** ✅ Merged **Merged:** 1/12/2022 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/migrie/b/12126-correct-old-cmdexe-paths` --- ### 📝 Commits (3) - [`62d604b`](https://github.com/microsoft/terminal/commit/62d604bcd1c2abbdd2f5864f652262d539ab9a70) this builds, but needs tests - [`ba37cd0`](https://github.com/microsoft/terminal/commit/ba37cd0259bff7585eae1b1161657750d4629de8) tests - [`c8c3202`](https://github.com/microsoft/terminal/commit/c8c32021582f43c0aa5795045f40f44e2e1b8374) ClearCommandline instead, for ergonomics ### 📊 Changes **4 files changed** (+76 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/LocalTests_SettingsModel/ProfileTests.cpp` (+57 -0) 📝 `src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp` (+1 -0) 📝 `src/cascadia/TerminalSettingsModel/CascadiaSettings.h` (+1 -0) 📝 `src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp` (+17 -0) </details> ### 📄 Description 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:31:20 +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#28875