Skip to content
This repository was archived by the owner on Sep 12, 2026. It is now read-only.

github, docs - #14

Merged
ismailkattakath merged 1 commit into
mainfrom
ci-hadolint-verified-download
Sep 6, 2026
Merged

ismailkattakath merged 1 commit into
mainfrom
ci-hadolint-verified-download

Conversation

@ismailkattakath

Copy link
Copy Markdown
Owner

What

The static-checks job fetched the Hadolint release binary with an unverified
curl -sL and sudo installed it into /usr/local/bin:

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

No sha256sum, no cosign, no gpg anywhere in the file. A substituted or
compromised release asset ran as root against the checkout on every PR.
The job is contents: read, so there is no repo-write path — but it reads the
checkout and can egress.

Change

  • sha256sum -c the asset against the hash published as
    hadolint-Linux-x86_64.sha256 in the same release, before it is ever executed.
  • Install as the runner user into $HOME/.local/bin (exported through
    $GITHUB_PATH) instead of sudo into /usr/local/bin.
  • curl -f, so an HTTP error page is not silently written out as the "binary".
  • Version and hash sit in env: as a pair, to be bumped together.

Why not hadolint/hadolint-action

It was the first choice. It does not fit, and pinning it by commit SHA would not
have closed the hole:

release pins its hadolint image by hadolint lints image/Dockerfile
v3.5.0 (06be81b) digest @sha256:9a3944b7… 2.15.1 fails DL3066
v3.4.0 mutable tag 2.15.0 fails DL3066
v3.3.0 mutable tag 2.14.0 passes
v3.1.0 mutable tag 2.12.0 passes

DL3066 ("Non-numeric user-id may not be resolvable by host system") fires on
USER app at image/Dockerfile:85. So the only release that digest-pins the
image it runs breaks the lint, and every release that lints clean pulls its
image by mutable tag — SHA-pinning the action would leave the thing it
actually executes floating. Hashing the binary pins it end to end.

Verification

  • sha256 56de6d5e…d55010 confirmed two ways: computed from a fresh download,
    and byte-matched against the published .sha256 release asset.
  • DL3066 behaviour reproduced per-version with ghcr.io/hadolint/hadolint
    2.12.0 / 2.14.0 / 2.15.0 / 2.15.1 against the real image/Dockerfile.
  • Install block replayed end to end in ubuntu:24.04: checksum OK, non-root
    install, hadolint 2.12.0 lints the Dockerfile clean.
  • Negative test: a tampered hash aborts the step (exit 1) before install.
  • actionlint (with shellcheck on run: blocks) clean across all four
    workflows; YAML re-parsed.

The apt-get shellcheck half is deliberately untouched.

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.
@ismailkattakath
ismailkattakath merged commit 2ba74a6 into main Sep 6, 2026
3 checks passed
@ismailkattakath
ismailkattakath deleted the ci-hadolint-verified-download branch September 6, 2026 07:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant