From da9e902e2c9a718228e9ac9573d302901dd3a4c1 Mon Sep 17 00:00:00 2001 From: Ismail Kattakath <8927166+ismailkattakath@users.noreply.github.com> Date: Sat, 5 Sep 2026 23:38:42 -0400 Subject: [PATCH] ci: verify the Hadolint download against a pinned sha256 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The static-checks job fetched hadolint-Linux-x86_64 over plain `curl -sL` and `sudo install`ed it — no checksum, no signature — so a compromised or substituted release asset ran as root against the checkout on every PR. Content-pin the asset instead: `sha256sum -c` against the hash published as hadolint-Linux-x86_64.sha256 in the same release, and install it as the runner user under $HOME/.local/bin (exported via $GITHUB_PATH) rather than sudo into /usr/local/bin. `curl -f` also stops an HTTP error page being silently written out as the "binary". hadolint/hadolint-action was the first choice and does not fit: the one release that digest-pins its own hadolint image (v3.5.0, 06be81b) ships 2.15.1, whose DL3066 fails image/Dockerfile on `USER app` — v3.4.0/2.15.0 does too. The releases that lint clean (v3.1.0, v3.3.0) pull their image by mutable tag, so SHA-pinning the action still leaves the thing it actually executes floating. Hashing the binary pins it end to end. --- .github/workflows/ci.yml | 18 +++++++++++++++--- CHANGELOG.md | 6 ++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc7ce4a..59c8239 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,12 +22,24 @@ jobs: - uses: actions/checkout@v4 - name: Install ShellCheck + Hadolint + env: + # Content-pin the release asset — bump BOTH together. The sha256 is the + # one published as hadolint-Linux-x86_64.sha256 in the same release. + HADOLINT_VERSION: v2.12.0 + HADOLINT_SHA256: 56de6d5e5ec427e17b74fa48d51271c7fc0d61244bf5c90e828aab8362d55010 run: | sudo apt-get update -qq sudo apt-get install -y -qq shellcheck - curl -sL -o /tmp/hadolint \ - "https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-x86_64" - sudo install -m 0755 /tmp/hadolint /usr/local/bin/hadolint + # Not hadolint/hadolint-action: the one release that digest-pins its own + # hadolint image (v3.5.0, 06be81b) ships 2.15.1, whose DL3066 fails this + # Dockerfile on `USER app` (so does v3.4.0/2.15.0); the releases that lint + # clean (v3.1.0, v3.3.0) pull their image by mutable tag. Hash the binary. + mkdir -p "$HOME/.local/bin" + curl -fsSL -o /tmp/hadolint \ + "https://github.com/hadolint/hadolint/releases/download/${HADOLINT_VERSION}/hadolint-Linux-x86_64" + echo "${HADOLINT_SHA256} /tmp/hadolint" | sha256sum -c - + install -m 0755 /tmp/hadolint "$HOME/.local/bin/hadolint" + echo "$HOME/.local/bin" >> "$GITHUB_PATH" - name: Seed dummy .env + compose config run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 549c63f..bf68493 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,12 @@ Versioning follows [SemVer](https://semver.org/) for tagged releases. - `hyperframes` CLI symlink resolved from the package's `bin` entry, so the CLI actually lands on `PATH` (was: "hyperframes CLI not on PATH" at runtime) +### Security + +- CI checks the Hadolint release binary against a pinned sha256 before running + it, and installs it as the runner user instead of `sudo`-ing it into + `/usr/local/bin` (was: an unverified `curl` on every PR) + ## [0.1.0] — 2026-07-27 ### Added