Skip to content

Commit 7456b62

Browse files
committed
ci: pin autotag binary by version + sha256
Replace the deprecated `git.io/autotag-install` one-liner with a direct download of `autotag_linux_amd64` from a pinned release, verified against a hardcoded SHA-256. Why: - The installer is generated by godownloader (also deprecated upstream) and, while it does check the checksum file published with each GitHub release, those checksums are mutable — anyone who can publish a release can publish matching checksums. There's no way to pin an out-of-band expected SHA. - autotag's maintainers are me and a couple of trusted ex-coworkers (incl. @will.milton) and I trust the code, but a compromise of the `autotag-dev` org or a maintainer account would silently flow into every pipeline that runs the installer. Hardcoding the SHA in our workflow makes that class of supply-chain attack fail loudly. - autotag rarely changes and we only use its most basic functionality, so we don't upgrade often. Grabbing the new binary's SHA from `checksums.txt` on bump is a cheap one-time step for meaningful hardening. See: https://github.com/autotag-dev/autotag/blob/main/README.md (CI install section) for the recommended pattern.
1 parent 416d8ba commit 7456b62

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

.github/workflows/release.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,23 @@ jobs:
4545
fetch-depth: 0
4646
fetch-tags: true
4747

48+
- name: install autotag
49+
# To bump: update AUTOTAG_VERSION and fetch the new SHA from the release's
50+
# checksums.txt (autotag_<version>_checksums.txt, line matching 'autotag_linux_amd64$').
51+
env:
52+
AUTOTAG_VERSION: 1.4.3
53+
AUTOTAG_SHA256: 85e7ec97d732800bb838085fd3f2e19b2aa2ee3a8da0db7fd0aaf4113a279f3a
54+
run: |
55+
set -euo pipefail
56+
mkdir -p "${RUNNER_TEMP}/bin"
57+
curl -fsSLo "${RUNNER_TEMP}/bin/autotag" \
58+
"https://github.com/autotag-dev/autotag/releases/download/v${AUTOTAG_VERSION}/autotag_linux_amd64"
59+
echo "${AUTOTAG_SHA256} ${RUNNER_TEMP}/bin/autotag" | sha256sum -c -
60+
chmod +x "${RUNNER_TEMP}/bin/autotag"
61+
4862
- name: Calculate new version with autotag
4963
run: |
5064
set -xeou pipefail
51-
52-
curl -sL https://git.io/autotag-install | sh -s -- -b "${RUNNER_TEMP}/bin"
5365
new_version=$(${RUNNER_TEMP}/bin/autotag -n)
5466
echo "new_version=$new_version" >> $GITHUB_ENV
5567

0 commit comments

Comments
 (0)