gsudo icon indicating copy to clipboard operation
gsudo copied to clipboard

Feature: Force elevation in new window

Open gerardog opened this issue 3 years ago • 1 comments

One way to ensure UIPI isolation is to elevate in a new window. If a user wants to ensure UIPI is respected is to force all elevations in new windows. To achieve this the user could do gsudo config ForceNewWindow true, and then all subsequent elevations would been done in new windows.

It is desired that a batch/script that uses gsudo would produce the same outcome (but without breaking uipi) even if ForceNewWindow is true or false. Unfortunatelly 'gsudo' currently doesn't know if it was called from a script or an interactive shell, and I doubt it could or should tell the difference.

Problems:

  • Output capturing: would break
  • Fast commands may open a new window, then close immediately. For example gsudo -n dir or gsudo cmd /k dir
  • Previous item could be fixed by opening cmd /k {command} instead of cmd /c (i.e. ´gsudo -n cmd /k dir´) but that would then break (change the outcome) of scripts using gsudo

gerardog avatar Aug 04 '21 05:08 gerardog

I have trouble finding an spec for this that fits all. Feedback wanted. But gsudo config SecurityEnforceUacIsolation true IMHO is easier to understand and does not break scripts.

gerardog avatar Aug 04 '21 17:08 gerardog

Completed in #190

Features:

  • Added setting gsudo config NewWindow.Force to force every elevation in new window. Same as using -n every time.

  • Added --KeepShell: Keep elevated shell open after running {command}.

  • Added --KeepWindow: When in new console, ask for keypress before closing the console.

  • Added setting gsudo config NewWindow.CloseBehaviour: OsDefault, KeepShellOpen (--KeepShell), PressKeyToClose (--KeepWindow)

  • Config syntax more relaxed now:

gsudo.exe config loglevel debug
gsudo.exe config loglevel=debug
gsudo.exe config loglevel="debug"
gsudo.exe config loglevel =  debug

image

image

image

gerardog avatar Oct 23 '22 19:10 gerardog

Released in v2.0.0 => https://gerardog.github.io/gsudo/docs/tips/elevation-in-new-window

gerardog avatar Nov 10 '22 23:11 gerardog