Skip to content

Validate COM package objects before accessing native state - #6686

Merged
AmirMS (AmelBawa-msft) merged 1 commit into
microsoft:masterfrom
AmelBawa-msft:user/amelbawa/validate-package-object-origin
Nov 16, 2026
Merged

AmirMS (AmelBawa-msft) merged 1 commit into
microsoft:masterfrom
AmelBawa-msft:user/amelbawa/validate-package-object-origin

Conversation

@AmelBawa-msft

@AmelBawa-msft AmirMS (AmelBawa-msft) commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

📖 Description

Validate COM package objects before accessing native state, returning E_INVALIDARG for unsupported objects.

🔗 References

🔍 Validation

✅ Checklist

🤖 AI Assistance

  • AI assistance was used and has been disclosed in this PR
  • No AI assistance was used

📋 Issue Type

  • Bug fix
  • Feature
  • Task
Microsoft Reviewers: Open in CodeFlow

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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

@AmelBawa-msft
AmirMS (AmelBawa-msft) marked this pull request as ready for review November 14, 2026 04:50
@AmelBawa-msft
AmirMS (AmelBawa-msft) requested a review from a team as a code owner November 14, 2026 04:50
@AmelBawa-msft
AmirMS (AmelBawa-msft) merged commit 66af7c1 into microsoft:master Nov 16, 2026
9 checks passed
@AmelBawa-msft
AmirMS (AmelBawa-msft) deleted the user/amelbawa/validate-package-object-origin branch November 16, 2026 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants