rust-lang / rust-lang/rustup

rustup-init should warn if user is elevated on Windows

Open
#3,329 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
22h 40m
Merged PRs (30d)
46

Description

Problem you are trying to solve

New users may expect an installer like rustup-init to need to be run as admin, so they elevate the process to admin. This can lead to problems when they then try to run with their standard user rights, either because of permissions or because it installed as a different user.

Solution you'd like

Detect if the user has elevated permissions and print a warning that this may not be what they want. Alternatively, instead of a warning maybe it could ask for confirmation?

Notes

It's possible this could be what's wanted so I don't think it should be a hard error.

This can be done using the GetTokenInformation function with the current process token to get the TOKEN_ELEVATION_TYPE. It will be set to TokenElevationTypeFull if the process is running with more rights than is the default for the user.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the rustup-init entry point and inspect the Windows-specific process-token handling. Read the linked GetTokenInformation and TOKEN_ELEVATION_TYPE documentation to determine how elevation is detected. Done means elevated users receive a warning or confirmation prompt, while the installer remains usable for cases where elevation is intentional.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, operating-systems
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.