Repository navigation
eng: verify toolchain archive SHA-256 - #2723
Closed
Quim Muntal (qmuntal) wants to merge 1 commit into
Closed
Quim Muntal (qmuntal) wants to merge 1 commit into
Quim Muntal (qmuntal) wants to merge 1 commit into
Conversation
Pin the existing installer generator to the integrity-hardening change in microsoft/go-infra#691 and regenerate the installer. Validate the manifest digest and verify the downloaded archive before extraction, without adding signature verification or new dependencies. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
Member
Author
|
Closing temporarily to land microsoft/go-infra#691 first. The installer update is deferred until the generator change is merged. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Relative archive paths can resolve differently during download, hashing, and extraction, causing valid downloads to fail verification or an unverified ZIP to be extracted.
1 open issue
What changed in this PR
This PR adds archive integrity checks to the Go toolchain installer using the generator update from microsoft/go-infra#691. SHA-256 verification detects corruption or mismatches but does not authenticate the manifest.
Changes:
- Pins the installer generator to the published source commit.
- Validates the selected asset’s SHA-256 format and checks the downloaded archive before extraction.
- Preserves JSON array values so malformed digest fields are rejected.
| File | Description |
|---|---|
| eng/_util/go.sum | Adds checksums for the updated generator dependency. |
| eng/_util/go.mod | Pins the generator version containing integrity checks. |
| eng/_util/go-install.ps1 | Adds digest validation, archive verification, and updated failure messages. |
Review effort: Balanced
| # This checks integrity, not authenticity: the manifest and archive are both remote. | ||
| # An attacker able to replace both can supply a matching digest. Authenticity requires | ||
| # verifying the signature at pgpSignatureUrl against a locally pinned Microsoft public key. | ||
| $ActualSHA256 = (Get-FileHash -LiteralPath $ArchivePath -Algorithm SHA256).Hash |
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.

Depends on microsoft/go-infra#691.
Summary
Update the existing installer generator dependency to the published source commit and regenerate the installer to validate the selected asset's 64-character hexadecimal SHA-256 digest and verify the downloaded archive before extraction.
The installer preserves dry-run, already-installed, and archive retention behavior. Its comment documents that this is integrity hardening, not authenticity verification: an attacker able to replace both the manifest and archive can supply a matching digest. PGP verification and new dependencies remain out of scope.
Validation
From
eng/_util:The pinned-generator consistency check and all 52 integrity cases pass using PowerShell 7 and Windows PowerShell 5.1.
git diff --checkalso passes.