Skip to content

eng: verify toolchain archive SHA-256 - #2723

Closed
Quim Muntal (qmuntal) wants to merge 1 commit into
microsoft/mainfrom
dev/qmuntal/goinstall-sha256
Closed

Quim Muntal (qmuntal) wants to merge 1 commit into
microsoft/mainfrom
dev/qmuntal/goinstall-sha256

Conversation

@qmuntal

Copy link
Copy Markdown
Member

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:

go test .\tools github.com/microsoft/go-infra/goinstallscript/powershell -run '^(TestInstallScriptUpToDate|TestInstallArchiveIntegrity)$' -count=1 -parallel 4

The pinned-generator consistency check and all 52 integrity cases pass using PowerShell 7 and Windows PowerShell 5.1. git diff --check also passes.

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>
@qmuntal
Quim Muntal (qmuntal) requested a review from a team as a code owner November 13, 2026 10:17
Copilot AI balanced review requested due to automatic review settings November 13, 2026 10:17
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@qmuntal

Copy link
Copy Markdown
Member Author

Closing temporarily to land microsoft/go-infra#691 first. The installer update is deferred until the generator change is merged.

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.

🟡 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

Comment thread eng/_util/go-install.ps1
# 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
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