-
Notifications
You must be signed in to change notification settings - Fork 8.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prompt before launching commandlines when elevated ; cache answers in elevated state.json
#11096
Closed
35 of 40 tasks
Labels
Area-UserInterface
Issues pertaining to the user interface of the Console or Terminal
Issue-Task
It's a feature request, but it doesn't really need a major design.
Product-Terminal
The new Windows Terminal.
Resolution-Won't-Fix
We're just really obstinate about this. There's probably a good reason.
Comments
This was referenced Sep 14, 2021
ghost
pushed a commit
that referenced
this issue
Sep 16, 2021
When we're elevated, we disable drag/dropping tabs when elevated, because of a platform limitation that causes the app to _crash_ (see #4874). However, if the user has UAC disabled, this actually works alright. So I'm adding it back in that case. I'm not positive if this is the best way to check if UAC is disabled, but normally, you'll get a [`TokenElevationTypeFull`] when elevated, not `TokenElevationTypeDefault`. If the app is elevated, but there's not a split token, that kinda implies there's no user account separation. If I'm wrong, it's just code, let's replace this with something that does work. ## Validation Steps Performed Booted up a Win10 VM, set `enableLUA` to `0`, rebooted, and checked if this exploded. It didn't. References #4874 References #3581 Work done in pursuit of #11096 Closes #7754 [`TokenElevationTypeFull`]: https://docs.microsoft.com/en-us/windows/win32/api/winnt/ne-winnt-token_elevation_type
4 tasks
4 tasks
lhecker
pushed a commit
that referenced
this issue
Nov 13, 2021
## Summary of the Pull Request This creates an `elevated-state.json` that lives in `%LOCALAPPDATA%` next to `state.json`, that's only writable when elevated. It doesn't _use_ this file for anything, it just puts the framework down for use later. It's _just like `ApplicationState`_. We'll use it the same way. It's readable when unelevated, which is nice, but not writable. If you're dumb and try to write to the file when unelevated, it'll just silently do nothing. If we try opening the file and find out the permissions are different, we'll _blow the file away entirely_. This is to prevent someone from renaming the original file (which they can do unelevated), then slapping a new file that's writable by them down in it's place. ## References * We're going to use this in #11096, but these PRs need to be broken up. ## PR Checklist * [x] Closes nothing * [x] I work here * [x] Tests added/passed * [ ] Requires documentation to be updated - maybe? not sure we have docs on `state.json` at all yet ## Validation Steps Performed I've played with this much more in `dev/migrie/f/non-terminal-content-elevation-warning` ###### followed by #11308, #11310
We're cutting this for the time being. We'll wait for a more official plan before we ship something like this. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Area-UserInterface
Issues pertaining to the user interface of the Console or Terminal
Issue-Task
It's a feature request, but it doesn't really need a major design.
Product-Terminal
The new Windows Terminal.
Resolution-Won't-Fix
We're just really obstinate about this. There's probably a good reason.
This is part of https://github.com/microsoft/terminal/projects/5, and a pre-req for #632. I'm promoting this to a full issue since I've got a lot of edge-case-y work that needs doing and tracking somewhere.
elevated-state.json
GENERIC_ALL
, Everyone:GENERIC_READ
- Didn't work. Elevated Terminal couldn't write the file.GENERIC_ALL
, Everyone:GENERIC_READ
- Didn't work. Sublime could just delete the file and write something else in it's place. Un-elevated Terminal could even write the file!DOMAIN_USER_RID_ADMIN
"Admin", not "Admins"?WriteFileAtomic
was the problem - the rename would discard the elevated only version of the file, then write a new one in it's place. Presumably, this doesn't really matter. We should only be calling into that function from an elevated window, but it's unfortunate that it doesn't prevent it from working when unelevated.WriteUTF8FileAtomic
. We don't need the link handling, so I'm not worried about that...isElevated()
logic to a common place to make sure we have one implementationisElevated()
inWriteUTF8File*()
, so that we can bail early if we're unelevated.unique_sid
and in general, make sure to clean up the things allocated for us.C:\windows\system32
.C:\windows\system32
%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe
will work.Complete
state, then process the actions one at a time?wt
action in an elevated window?wt nt ; sp
, then reject the first tab? There are no tabs now to split!Engineering deets
dev/migrie/uac-shield
dev/migrie/f/632-attempt-2
what happens when multiple controls should be added at once
Idea A: for scenarios where we're going to perform multiple actions, check all of them for commandlines. If we find one action that has an unapproved commandline, then ask the user if they want to run all of the actions. They either approve them all, or none of them.
Idea B: Use a fake content dialog as a placeholder control, until the connection is approved.
IPaneContent
interface that exposed all the things a TermControl might do.Closed()
? How does the pane listen for that...AdminWarningPlaceholder
will be holding the Pane, theThe text was updated successfully, but these errors were encountered: