Skip to content
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

Configuration file should have a property for elevated privileges #3403

Closed
totkeks opened this issue Jul 2, 2023 · 1 comment
Closed

Configuration file should have a property for elevated privileges #3403

totkeks opened this issue Jul 2, 2023 · 1 comment
Labels
Command-Configure Issue related to WinGet Configuration Issue-Feature This is a feature request for the Windows Package Manager client.
Milestone

Comments

@totkeks
Copy link

totkeks commented Jul 2, 2023

Description of the new feature / enhancement

I tried to write a configuration file that updates a registry key. It failed at first run, because my PowerShell inside VS code isn't elevated, which the error told me. When running it again in an elevated shell, everything was fine.

Looking for solutions on how to place that requirement in the assertions section of the configuration I didn't find any specific DSC resource to accomplish this. Only a DscResource.Common function called Assert-ElevatedUser.

After thinking about putting that in a Script resource, I realized that it isn't really a state of the system itself, but only the current runtime/process. Thus, it would be better suited as an additional property inside the configuration file instead of a resource.

Proposed technical implementation details

Add a new boolean property in the configuration dsc schema below properties called something like requiresElevation, that would be optional with a default of false.

winget configure would then check for elevation if that property is true. If that is not the case it could either fail with an appropriate error message or restart the process as an elevated user, triggering the usual UAC prompt in Windows.

Further improvements could range from adding the property to individual resources and only running them in elevated mode or extending the property from a boolean to an array of privileges required to apply the configuration, though I'm not too deep into Windows administration to know if that is feasible or useful.

@totkeks totkeks added the Issue-Feature This is a feature request for the Windows Package Manager client. label Jul 2, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage Issue need to be triaged label Jul 2, 2023
@stephengillie stephengillie removed the Needs-Triage Issue need to be triaged label Jul 3, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the Command-Configure Issue related to WinGet Configuration label Jul 7, 2023
@Gijsreyn
Copy link
Contributor

I was learning about Winget, and I think the securityContext: elevated has now been added.

@denelon denelon added this to the 1.10 Client milestone Feb 1, 2025
@denelon denelon closed this as completed Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Command-Configure Issue related to WinGet Configuration Issue-Feature This is a feature request for the Windows Package Manager client.
Projects
None yet
Development

No branches or pull requests

4 participants