Repository navigation
Validate COM package objects before accessing native state - #6686
Merged
AmirMS (AmelBawa-msft) merged 1 commit intoNov 16, 2026
Conversation
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The security-sensitive COM/native-state boundary needs Windows cross-process validation to confirm legitimate package round-trips and rejection of foreign proxies, since existing tests cover only in-process objects.
No open issues 🎉
What changed in this PR
This PR replaces direct implementation casts with checked access to native repository state for package objects passed to the WinGet COM API.
Changes:
- Adds local-only internal interfaces and validates package objects before retrieving native state.
- Updates package-manager workflows to use the checked accessors.
- Adds tests for rejecting foreign and null objects, preserving native-state lifetimes, and documents the behavior in release notes.
| File | Description |
|---|---|
| src/Microsoft.Management.Deployment/PackageVersionInfo.h | Declares the internal version interface and checked accessor. |
| src/Microsoft.Management.Deployment/PackageVersionInfo.cpp | Validates version objects before returning native state. |
| src/Microsoft.Management.Deployment/PackageManager.cpp | Replaces direct implementation casts with checked accessors. |
| src/Microsoft.Management.Deployment/CatalogPackage.h | Declares the internal package interface and checked accessor. |
| src/Microsoft.Management.Deployment/CatalogPackage.cpp | Validates catalog package objects before returning native state. |
| src/AppInstallerCLITests/PackageObjectAccess.cpp | Tests object rejection and native-state lifetime preservation. |
| src/AppInstallerCLITests/AppInstallerCLITests.vcxproj.filters | Adds the test file to the source filter. |
| src/AppInstallerCLITests/AppInstallerCLITests.vcxproj | Registers the tests and required deployment-project dependency. |
| doc/release-notes/1.31/validate-package-object-origin.md | Notes error handling for unsupported COM package objects. |
Review effort: Balanced
AmirMS (AmelBawa-msft)
marked this pull request as ready for review
November 14, 2026 04:50
JohnMcPMS
approved these changes
Nov 16, 2026
AmirMS (AmelBawa-msft)
deleted the
user/amelbawa/validate-package-object-origin
branch
November 16, 2026 23:55
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
Validate COM package objects before accessing native state, returning
E_INVALIDARGfor unsupported objects.🔗 References
🔍 Validation
✅ Checklist
🤖 AI Assistance
📋 Issue Type
Microsoft Reviewers: Open in CodeFlow