Optimize packaged temp ACL handling without weakening ACL repairs#6171
Merged
JohnMcPMS merged 3 commits intomicrosoft:masterfrom Apr 24, 2026
Merged
Conversation
Contributor
Author
|
@microsoft-github-policy-service agree company="Devolutions" |
8976b07 to
25fb658
Compare
JohnMcPMS
reviewed
Apr 22, 2026
There was a problem hiding this comment.
Pull request overview
This PR addresses the packaged-context slowdown when resolving temp paths by avoiding unnecessary recursive ACL propagation on large %TEMP%\WinGet trees, while preserving the existing fail-closed “repair ACLs before use” security behavior.
Changes:
- Add an ACL inspection/short-circuit path so
ApplyACL()is only invoked when ownership/DACL protection/effective permissions don’t already match the expected secure state. - Scope packaged temp paths under the runtime state name (matching unpackaged behavior) to keep any required ACL repair bounded to a winget-managed subtree.
- Add runtime tests covering the steady-state “skip” case and mismatch cases that must force ACL repair.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/AppInstallerSharedLib/Public/winget/Filesystem.h |
Updates ShouldApplyACL() description to reflect the new “needs to be applied” semantics. |
src/AppInstallerSharedLib/Filesystem.cpp |
Implements ACL inspection logic and updates ShouldApplyACL() to be fail-closed while skipping redundant ACL reapplication. |
src/AppInstallerCommonCore/Runtime.cpp |
Updates packaged temp path to include the runtime state name to avoid operating on the shared %TEMP%\\WinGet root. |
src/AppInstallerCLITests/Runtime.cpp |
Adds runtime tests for ACL skip/reapply behavior and for the packaged temp path state-name scoping. |
Member
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
JohnMcPMS
reviewed
Apr 23, 2026
Member
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
JohnMcPMS
approved these changes
Apr 24, 2026
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.
Fixes #6162
Summary
This change reduces the severe slowdown caused by recursive ACL propagation on packaged temp paths while preserving the security behavior that repairs improperly secured directories before use.
The fix keeps the existing fail-closed model, but avoids calling
ApplyACL()when the target directory is already in the exact secure state winget expects.Changes
ApplyACL()%TEMP%\WinGettreeWhy this is safe
The security intent of the original code is preserved: winget still repairs attacker-created or incorrectly ACL'd directories before using them.
This PR only removes unnecessary recursive ACL work in the steady state where the directory is already secure. If the ACL state cannot be verified confidently, winget keeps the existing repair behavior.
Validation
Microsoft Reviewers: Open in CodeFlow