Skip to content

Verify downloaded Terraform archive against the published SHA256SUMS - #561

Open
somaz94 wants to merge 1 commit into
hashicorp:mainfrom
somaz94:feat/verify-checksum
Open

somaz94 wants to merge 1 commit into
hashicorp:mainfrom
somaz94:feat/verify-checksum

Conversation

@somaz94

@somaz94 somaz94 commented Jun 12, 2026

Copy link
Copy Markdown

Related Issue

Fixes #556

Description

setup-terraform downloaded 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:

await release.verify(pathToCLIZip, build.filename);

@hashicorp/js-releases (already a dependency) exposes Release.verify(pkg, buildName), which fetches the release's terraform_<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

Rollback Plan

  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

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 SHA256SUMS before it is extracted or placed on the PATH. A failed or missing verification aborts the install. No logging, access-control, or credential-handling behavior changes.

@somaz94
somaz94 marked this pull request as ready for review June 12, 2026 06:32
@somaz94
somaz94 requested a review from a team as a code owner June 12, 2026 06:32
@somaz94

somaz94 commented Jul 8, 2026

Copy link
Copy Markdown
Author

Light ping 🙂 — this has been green and awaiting review for about 4 weeks now. Happy to rebase or address any feedback whenever a maintainer has a chance to take a look. Thanks for maintaining this project!

@somaz94

somaz94 commented Aug 10, 2026

Copy link
Copy Markdown
Author

@rainkwan @ansgarm — following up on my 8 Jul note, and correcting it: I said this had been green for about four weeks, which wasn't right. There are no workflow runs at all on this PR — zero runs and zero check suites — with license/cla as the only check. Apologies for that.

It looks like this one predates the current fork-PR approval gate: newer fork PRs (#570, #571) at least register runs sitting at action_required, whereas this PR has no run record whatsoever. I'd guess a rebase would materialise them, though they'd still need approving.

Happy to push a rebase if that's the easier path — or approve/dispatch it as-is if that's simpler. The change verifies the downloaded Terraform archive against the published SHA256SUMS before extracting.

@somaz94

somaz94 commented Sep 10, 2026

Copy link
Copy Markdown
Author

Checking in on this one. It verifies the downloaded archive against the published SHA256SUMS before extracting, and it is green. If there is anything you would like changed in the approach, I am glad to rework it.

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.

Verify downloaded Terraform zip against published SHA256SUMS / SHA256SUMS.sig

1 participant