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

Use digest verification APIs for MSIX when available #4564

Merged
merged 2 commits into from
Jun 19, 2024

Conversation

JohnMcPMS
Copy link
Member

@JohnMcPMS JohnMcPMS commented Jun 19, 2024

Change

When available (10.0.23504.0 according to MSDN), use the MSIX digest APIs to verify the package during streaming installation. When not available, download instead.

Validation

Manual installation successful, with logs indicating usage of digest. Manual installation with debugger memory change to invalidate the digest results in an error (although not the best error experience, it should also be extremely rare).

Existing regression tests should get some coverage as well.

Microsoft Reviewers: Open in CodeFlow

@JohnMcPMS JohnMcPMS requested a review from a team as a code owner June 19, 2024 17:48
Comment on lines +77 to +101
if (!options.ExpectedDigests.empty())
{
// Must use API that supports digests
THROW_WIN32_IF(ERROR_NOT_SUPPORTED, !IsExpectedDigestsSupported());

AddPackageOptions addPackageOptions;

for (const auto& digest : options.ExpectedDigests)
{
addPackageOptions.ExpectedDigests().Insert(Uri{ Utility::ConvertToUTF16(digest.first) }, digest.second);
}

return packageManager.AddPackageByUriAsync(uri, addPackageOptions);
}
else if (options.SkipReputationCheck)
{
return packageManager.AddPackageAsync(
uri,
nullptr, /*dependencyPackageUris*/
DeploymentOptions::None,
nullptr, /*targetVolume*/
nullptr, /*optionalAndRelatedPackageFamilyNames*/
nullptr, /*optionalPackageUris*/
nullptr /*relatedPackageUris*/);
}
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason to have these two branches separate? I would find it easier to understand if we had as few different calls to *AddPackage*Async()
Only reason I can think of is if AddPackageByUriAsync() wasn't available downlevel, but it goes back to 19041 which I think is the oldest supported version

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't want to remove it until we change the minimum version for the shipping package:

<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.22621.0"/>

@JohnMcPMS JohnMcPMS merged commit 57907ac into microsoft:master Jun 19, 2024
8 checks passed
@JohnMcPMS JohnMcPMS deleted the digest branch June 19, 2024 21:35
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.

2 participants