Verify downloaded Terraform archive against the published SHA256SUMS#561
Open
somaz94 wants to merge 1 commit into
Open
Verify downloaded Terraform archive against the published SHA256SUMS#561somaz94 wants to merge 1 commit into
somaz94 wants to merge 1 commit into
Conversation
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.
Related Issue
Fixes #556
Description
setup-terraformdownloaded the Terraform release zip and extracted it without verifying its integrity — TLS protected the bytes in transit, but the action took no defense-in-depth step beyond that, so a compromised mirror, CDN incident, or any future change to the resolved URL could land an arbitrary binary on every runner.This adds a single verification step in
downloadCLI, right after the download and before extraction:@hashicorp/js-releases(already a dependency) exposesRelease.verify(pkg, buildName), which fetches the release'sterraform_<v>_SHA256SUMS, verifies its detached PGP signature against the embedded HashiCorp release key, then compares the SHA-256 of the downloaded archive against the signed checksum — failing the install loudly on any mismatch. Reusing this existing, already-vendored method keeps the change minimal and covers both the SHA-256 check and the stronger signature-verification path described in the issue, with no new input or behavior toggle.The Apache Software Foundation flags every release of this action in its approved-actions allowlist because of this missing check (see #556); this closes that gap so future version bumps no longer require a manual security re-review.
Validation
npm test— semistandard clean, 19/19 jest pass (added 2 tests: verification is invoked with the platform build name; a checksum mismatch aborts before extraction).npm run build—dist/rebuilt; diff is limited to the logical change.ENHANCEMENTSfragment for Verify downloaded Terraform zip against published SHA256SUMS / SHA256SUMS.sig #556.Rollback Plan
Changes to Security Controls
Yes. This adds an integrity control to the install path: the downloaded Terraform archive is now verified against HashiCorp's PGP-signed
SHA256SUMSbefore it is extracted or placed on thePATH. A failed or missing verification aborts the install. No logging, access-control, or credential-handling behavior changes.