Skip to content

Commit

Permalink
Fix defterm + elevate by default (#12442)
Browse files Browse the repository at this point in the history
We absolutely cannot allow a defterm connection to
auto-elevate. Defterm doesn't work for elevated senarios in the
first place. If we try accepting the connection, the spawning an
elevated version of the Terminal with that profile... that's a
recipe for disaster. We won't ever open up a tab in this window.

* [x] Closes #12370
* [x] Tested manually, since there's not a great way to add defterm tests

(cherry picked from commit 303f9d7)
  • Loading branch information
zadjii-msft authored and DHowett committed Feb 9, 2022
1 parent f740cf0 commit 37b59c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/cascadia/TerminalApp/TerminalPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3095,9 +3095,12 @@ namespace winrt::TerminalApp::implementation
{
NewTerminalArgs newTerminalArgs;
newTerminalArgs.Commandline(connection.Commandline());
const auto profile{ _settings.GetProfileForArgs(newTerminalArgs) };
const auto settings{ TerminalSettings::CreateWithProfile(_settings, profile, *_bindings) };

// GH #12370: We absolutely cannot allow a defterm connection to
// auto-elevate. Defterm doesn't work for elevated scenarios in the
// first place. If we try accepting the connection, the spawning an
// elevated version of the Terminal with that profile... that's a
// recipe for disaster. We won't ever open up a tab in this window.
newTerminalArgs.Elevate(false);
_CreateNewTabFromPane(_MakePane(newTerminalArgs, false, connection));

// Request a summon of this window to the foreground
Expand Down
2 changes: 1 addition & 1 deletion src/cascadia/TerminalSettingsModel/ActionArgs.idl
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ namespace Microsoft.Terminal.Settings.Model
String ColorScheme;
// This needs to be an optional so that the default value (null) does
// not modify whatever the profile's value is (either true or false)
Windows.Foundation.IReference<Boolean> Elevate { get; };
Windows.Foundation.IReference<Boolean> Elevate;

Boolean Equals(NewTerminalArgs other);
String GenerateName();
Expand Down

0 comments on commit 37b59c1

Please sign in to comment.