Skip to content

fix: pin install script URLs to commit SHAs and eliminate pipe-to-shell#246

Merged
maniSbindra merged 6 commits into
mainfrom
fix/pin-install-script-dependencies
Apr 14, 2026
Merged

fix: pin install script URLs to commit SHAs and eliminate pipe-to-shell#246
maniSbindra merged 6 commits into
mainfrom
fix/pin-install-script-dependencies

Conversation

@maniSbindra

@maniSbindra maniSbindra commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes 6 OpenSSF Scorecard Pinned-Dependencies alerts (#5, #6, #7, #8, #9, #10) flagged by GitHub Advanced Security. Also addresses review feedback to centralize SHA management and bumps Go to fix stdlib vulnerabilities.

Problem

Six install scripts used curl | bash with unpinned URLs (branch refs like master/main or URL shorteners like aka.ms). This is a supply-chain risk: if the remote script is compromised, arbitrary code runs with the user's privileges.

Changes

1. Pin installer script URLs to commit SHAs and eliminate pipe-to-shell

For each of the 6 scripts:

  • Pinned URLs to commit SHAs — replaced branch refs and URL shorteners with raw.githubusercontent.com URLs pinned to specific commit SHAs
  • Eliminated pipe-to-shell — scripts are now downloaded to a temp file via curl -o, then executed
  • Added cleanup trapstrap cleanup EXIT INT TERM ensures temp directories are removed

2. Centralize installer SHAs in Taskfile vars maps

Per review feedback from @DariuszPorowski, moved hardcoded INSTALL_SCRIPT_SHA values from shell scripts into *_INSTALLER_SHA vars maps in each domain Taskfile:

Taskfile Vars Map Tools
github.Taskfile.yml GITHUB_INSTALLER_SHA actionlint, act
golang.Taskfile.yml GO_INSTALLER_SHA golangci-lint
azure.Taskfile.yml AZURE_INSTALLER_SHA azd
terraform.Taskfile.yml TERRAFORM_INSTALLER_SHA opentofu
runtime.Taskfile.yml RUNTIME_INSTALLER_SHA fnm

Scripts now read the SHA from the INSTALLER_SHA env var passed by the Taskfile cmd block. Each SHA line includes a version tag or commit date comment for traceability.

3. Bump Go from 1.26.1 to 1.26.2

Fixes 4 stdlib vulnerabilities:

  • GO-2026-4947 — unexpected work during chain building in crypto/x509
  • GO-2026-4946 — inefficient policy validation in crypto/x509
  • GO-2026-4870 — unauthenticated TLS 1.3 KeyUpdate DoS in crypto/tls
  • GO-2026-4866 — case-sensitive excludedSubtrees auth bypass in crypto/x509
Script Source Repo Pinned SHA
install_act.sh nektos/act fe017a1
install_actionlint.sh rhysd/actionlint 62c50a9
install_azd.sh Azure/azure-dev 0340065
install_golangci-lint.sh golangci/golangci-lint 870ddc1
install_opentofu.sh opentofu/get.opentofu.org c4f7de9
setup_fnm.sh Schniz/fnm bfb1860

Validation

  • task sh:lint — shellcheck + shfmt pass for all modified scripts
  • task build:mpf — Go binary compiles
  • task go:lint — golangci-lint + govulncheck pass (0 vulnerabilities)
  • task testunit — 74/74 unit tests pass

Maintainability

SHAs are centralized in the Taskfile *_INSTALLER_SHA vars maps with version/date annotations. To update a SHA, edit the single line in the relevant Taskfile.

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.

Pull request overview

This PR hardens several Task helper installer scripts by reducing supply-chain risk and addressing OpenSSF Scorecard “Pinned-Dependencies” findings in the repository’s script-based tool setup flow.

Changes:

  • Replace unpinned/shortened installer URLs with raw.githubusercontent.com URLs pinned to specific commit SHAs.
  • Remove curl | sh/bash patterns by downloading installer scripts to a temporary file before execution.
  • Add temp directory cleanup via trap to ensure downloaded scripts are removed on exit/signals.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
.taskfiles/scripts/install_act.sh Pins act installer script to a commit SHA and executes from a downloaded temp file.
.taskfiles/scripts/install_actionlint.sh Pins actionlint download script to a commit SHA and removes pipe-to-shell execution.
.taskfiles/scripts/install_azd.sh Replaces aka.ms shortlink with a commit-pinned raw GitHub URL and executes locally downloaded script.
.taskfiles/scripts/install_golangci-lint.sh Pins golangci-lint install script to a commit SHA and executes it from disk.
.taskfiles/scripts/install_opentofu.sh Pins the OpenTofu installer script to a commit SHA and avoids piping to a shell.
.taskfiles/scripts/setup_fnm.sh Pins the fnm installer script to a commit SHA and executes from a downloaded temp file.

@maniSbindra

Copy link
Copy Markdown
Contributor Author

@DariuszPorowski Please have a look if you find time. Thanks, Mani

@DariuszPorowski DariuszPorowski left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each of the "domain" taskfiles has version section,

GITHUB_VERSION:

Can you use this to provide SHA, instead of hardcoding in scripts?

vars:
  GITHUB_VERSION:
    map:
      actionlint: 123...456 # v1.2.3
      act: latest

@maniSbindra maniSbindra force-pushed the fix/pin-install-script-dependencies branch from f9a2351 to 6a192a4 Compare April 9, 2026 10:17
@maniSbindra maniSbindra requested a review from Copilot April 9, 2026 10:22

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.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.

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.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.

Comment thread .taskfiles/scripts/install_act.sh
Comment thread .taskfiles/scripts/install_actionlint.sh
Comment thread .taskfiles/scripts/install_golangci-lint.sh
Comment thread .taskfiles/scripts/install_azd.sh
Comment thread .taskfiles/scripts/install_opentofu.sh
Comment thread .taskfiles/scripts/setup_fnm.sh

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.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.

Comment thread .taskfiles/scripts/setup_fnm.sh
Comment thread .taskfiles/scripts/install_opentofu.sh
Comment thread .taskfiles/scripts/install_golangci-lint.sh
Comment thread .taskfiles/scripts/install_azd.sh
Comment thread .taskfiles/scripts/install_actionlint.sh
Comment thread .taskfiles/scripts/install_act.sh

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.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.

Comment thread .taskfiles/scripts/install_act.sh
Comment thread .taskfiles/scripts/install_actionlint.sh
Comment thread .taskfiles/scripts/install_azd.sh
Comment thread .taskfiles/scripts/install_golangci-lint.sh
Comment thread .taskfiles/scripts/install_opentofu.sh
Comment thread .taskfiles/scripts/setup_fnm.sh

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.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.

maniSbindra and others added 6 commits April 13, 2026 13:01
Replace `curl | bash` pattern with download-to-temp-file execution in 6
install scripts flagged by OpenSSF Scorecard (Pinned-Dependencies).

Changes per script:
- Pin raw.githubusercontent.com URLs to specific commit SHAs instead of
  branch refs (master/main) or URL shorteners (aka.ms, get.opentofu.org,
  fnm.vercel.app)
- Download install scripts to temp files before executing (no more piping
  curl output directly to shell)
- Add cleanup traps to remove temp directories on exit

Affected scripts:
- install_act.sh (nektos/act@fe017a1)
- install_actionlint.sh (rhysd/actionlint@62c50a9)
- install_azd.sh (Azure/azure-dev@0340065)
- install_golangci-lint.sh (golangci/golangci-lint@870ddc1)
- install_opentofu.sh (opentofu/get.opentofu.org@c4f7de9)
- setup_fnm.sh (Schniz/fnm@bfb1860)

Resolves GitHub Advanced Security alerts #5, #6, #7, #8, #9, #10.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move hardcoded INSTALL_SCRIPT_SHA values from shell scripts into
*_INSTALLER_SHA vars maps in each domain Taskfile. Scripts now read
the SHA from the INSTALLER_SHA env var passed by the Taskfile cmd
block, keeping tool versions and installer SHAs as separate concerns.

This addresses review feedback to follow the repo's existing pattern
of centralizing configuration in Taskfile vars.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds a regex guard in all 6 installer scripts to reject non-SHA
values (e.g., branch names like 'main') and prevent silently
reintroducing unpinned dependency risk.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…cripts

The VERSION="${1:-${VERSION:-latest}}" line was accidentally removed
during the SHA validation commit, causing scripts to crash under set -u
when referencing the unbound VERSION variable.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Update usage() in all 6 install scripts to document INSTALLER_SHA as a
required environment variable, with examples showing the env var prefix
and a note that Taskfile sets it automatically.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Break single-line || { ...; } patterns into multi-line format to
satisfy shfmt CI linting rules.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@DariuszPorowski DariuszPorowski force-pushed the fix/pin-install-script-dependencies branch from 2a0a075 to f66a2ca Compare April 13, 2026 20:01
@maniSbindra maniSbindra enabled auto-merge April 14, 2026 04:04
@maniSbindra maniSbindra disabled auto-merge April 14, 2026 04:10
@maniSbindra maniSbindra added this pull request to the merge queue Apr 14, 2026
Merged via the queue into main with commit bb4e5eb Apr 14, 2026
17 checks passed
@maniSbindra maniSbindra deleted the fix/pin-install-script-dependencies branch April 14, 2026 05:04
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.

3 participants