Repository navigation
Conversation
This comment has been minimized.
This comment has been minimized.
4 of 11 tasks
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Critical issues remain: elevated installs can consume attacker-controlled SQLite state, and forced reinstalls can fail then delete untouched installation data during rollback.
2 open issues
What changed in this PR
This PR broadens WinGet’s elevated-process restrictions to prevent package operations from using data writable without administrator privileges. It also separates fresh portable installations from operations that load existing installation state.
Changes:
- Centralizes elevation checks across uninstall, repair, uninstall-previous, portable upgrades, and font operations.
- Refactors portable installation state and SQLite cleanup, and derives dependency upgrade status independently.
- Adds regression tests, consistent error messages, and release notes.
| File | Description |
|---|---|
| src/Microsoft.Management.Deployment/Converters.h | Maps elevation rejection to an install error. |
| src/AppInstallerSharedLib/SQLiteStorageBase.cpp | Adds database deletion and shared-memory sidecar handling. |
| src/AppInstallerSharedLib/Public/winget/SQLiteStorageBase.h | Declares database cleanup API. |
| src/AppInstallerSharedLib/Errors.cpp | Updates elevation error guidance. |
| src/AppInstallerCommonCore/Public/winget/ManifestCommon.h | Declares installer-data classification helper. |
| src/AppInstallerCommonCore/Manifest/ManifestCommon.cpp | Classifies user-scope installer data by type. |
| src/AppInstallerCLITests/WorkflowBase.cpp | Tests shared elevation guards. |
| src/AppInstallerCLITests/UpdateFlow.cpp | Makes portable update tests independent of host elevation. |
| src/AppInstallerCLITests/UninstallFlow.cpp | Expands user-scope uninstall protection tests. |
| src/AppInstallerCLITests/SQLiteWrapper.cpp | Tests database and sidecar cleanup. |
| src/AppInstallerCLITests/RepairFlow.cpp | Tests rejection before repair preparation. |
| src/AppInstallerCLITests/PortableInstaller.cpp | Tests fresh, upgrade, and rollback state handling. |
| src/AppInstallerCLITests/InstallFlow.cpp | Tests elevation rules for installation paths. |
| src/AppInstallerCLITests/InstallDependenciesFlow.cpp | Tests dependency-specific upgrade state. |
| src/AppInstallerCLITests/AppInstallerCLITests.vcxproj.filters | Groups the new workflow tests. |
| src/AppInstallerCLITests/AppInstallerCLITests.vcxproj | Includes the new workflow tests in builds. |
| src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw | Consolidates localized elevation errors and translation context. |
| src/AppInstallerCLICore/Workflows/WorkflowBase.h | Documents shared elevation guard contracts. |
| src/AppInstallerCLICore/Workflows/WorkflowBase.cpp | Implements shared elevation guards. |
| src/AppInstallerCLICore/Workflows/UninstallFlow.cpp | Applies centralized checks before uninstall preparation. |
| src/AppInstallerCLICore/Workflows/ShellExecuteInstallerHandler.h | Corrects repair workflow documentation. |
| src/AppInstallerCLICore/Workflows/ShellExecuteInstallerHandler.cpp | Removes the repair guard moved earlier in the workflow. |
| src/AppInstallerCLICore/Workflows/RepairFlow.cpp | Checks elevation before preparing repairs. |
| src/AppInstallerCLICore/Workflows/PortableFlow.h | Updates portable workflow contracts. |
| src/AppInstallerCLICore/Workflows/PortableFlow.cpp | Resolves installed scope and guards portable updates. |
| src/AppInstallerCLICore/Workflows/InstallFlow.cpp | Checks uninstall-previous and font installation support. |
| src/AppInstallerCLICore/Workflows/FontFlow.h | Declares and documents font elevation checks. |
| src/AppInstallerCLICore/Workflows/FontFlow.cpp | Guards font installation and removal by scope. |
| src/AppInstallerCLICore/Workflows/DependenciesFlow.h | Clarifies dependency context outputs and operation selection. |
| src/AppInstallerCLICore/Workflows/DependenciesFlow.cpp | Sets upgrade flags from each dependency’s installed state. |
| src/AppInstallerCLICore/Resources.h | Replaces operation-specific elevation resource identifiers. |
| src/AppInstallerCLICore/PortableInstaller.h | Makes operation type explicit and adjusts cleanup state. |
| src/AppInstallerCLICore/PortableInstaller.cpp | Separates fresh installation from existing-state handling. |
| doc/release-notes/1.31/user-scope-elevation-guards.md | Documents restrictions and dependency fixes. |
Review effort: Balanced
This comment was marked as outdated.
This comment was marked as outdated.
Member
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

📖 Description
Standardizes and broadens the blocks in place to prevent elevated processes from acting on data writable at a lower integrity level. The goal of this change is to prevent the potential for EoP attacks via system artifacts for packages.
I am hoping to follow it up reasonably soon with another change to allow these scenarios to function once again, but safely by running the intended action at a lower integrity level.
🔍 Validation
Tests are added, but mostly to ensure the security aspects. This will certainly cause failures in some scenarios that previously worked, but that is unavoidable without the much more complex change mentioned earlier.
Microsoft Reviewers: Open in CodeFlow