Skip to content

Enforce hash requirements - #6629

Open
JohnMcPMS wants to merge 2 commits into
microsoft:masterfrom
JohnMcPMS:must-hash
Open

JohnMcPMS wants to merge 2 commits into
microsoft:masterfrom
JohnMcPMS:must-hash

Conversation

@JohnMcPMS

@JohnMcPMS JohnMcPMS commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

📖 Description

REST installer parsing did not require hashes, which is only acceptable for installer types where we do not control the download (Store-based MSIX installs only right now). Make not having a required hash result in an ignored installer, as we do for other required fields.

Hash validation further allowed the empty hash to accept anything. While that matches with some form of expectation, we don't really want that. Hash validation is now required to occur if the task is invoked.

🔍 Validation

Added new tests for the hash validation and REST response parsing.
Fixed a number of test overrides that relied on the validation skip.

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.

🟢 Approval recommended

No active review issues remain for the changes strengthening installer hash integrity checks.

No open issues 🎉

What changed in this PR

This PR strengthens WinGet’s installer integrity checks by requiring hashes for REST installers except Microsoft Store installers and removing the empty-hash verification bypass.

Changes:

  • Centralizes installer hash requirements and skips REST installers missing a required hash.
  • Rejects empty or unequal hashes during verification and supports logging malformed hashes.
  • Adds regression tests, updates test helpers to supply real hashes, and documents the behavior change.
File Description
src/​AppInstallerRepositoryCore/​Rest/​Schema/​1_0/​Json/​ManifestDeserializer_1_0.cpp Skips installers missing required hashes.
src/​AppInstallerCommonCore/​Public/​winget/​ManifestCommon.h Declares the shared hash-requirement helper.
src/​AppInstallerCommonCore/​Manifest/​ManifestValidation.cpp Uses the shared hash requirement during validation.
src/​AppInstallerCommonCore/​Manifest/​ManifestCommon.cpp Defines the Microsoft Store hash exemption.
src/​AppInstallerCommonCore/​AppInstallerTelemetry.cpp Logs hashes without requiring valid SHA256 lengths.
src/​AppInstallerCLITests/​WorkflowCommon.h Declares the test installer hash helper.
src/​AppInstallerCLITests/​WorkflowCommon.cpp Supplies computed hashes in download overrides.
src/​AppInstallerCLITests/​WorkFlow.cpp Tests missing, mismatched, and unequal-length hashes.
src/​AppInstallerCLITests/​RestInterface_1_0.cpp Tests REST hash requirements and the Store exemption.
src/​AppInstallerCLITests/​InstallFlow.cpp Updates installation overrides with computed hashes.
src/​AppInstallerCLICore/​Workflows/​DownloadFlow.cpp Rejects empty hashes and compares both complete ranges.
doc/​release-notes/​1.31/​require-rest-installer-hash.md Adds a user-facing release note.

Review effort: Balanced

@ranm-msft ranm-msft 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.

Hash requirement propagation and REST validation look correct; focused test coverage and exact-head CI are green.

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.

4 participants