Pin both base images by digest, and read only pkg_hash in the lock check (images-to-forge P1e) #1

Open
pluto wants to merge 0 commits from pluto/p1-pin into main
Member

P1e of the images-to-forge package (macula-io/martha#601), under DECIDED 2026-11-22 "images should move to forgejo".

What it pins

  • Containerfile: both FROMs by @sha256 at the FROM line. The tag stays beside each digest as a comment; the ARGs that carried the tag are gone.
  • scripts/assert_rebar_lock_has_hashes.sh, run from .github/workflows/lint.yml after the resolve: every hex package in rebar.lock must carry its pkg_hash, and the check fails when the lock names no package at all.

The second commit is the lock-check fix
The first version matched a checksum line by its shape, so a package's own blake2b line in pkg_hash_ext satisfied it after its pkg_hash was stripped: it said "all N packages carry their sha256" on a lock that carried none for that package. The fix follows the list headers ({pkg_hash,[ only), needs 64 hex, and refuses a missing list.

Why
A tag can be moved, so a build that names one builds other bytes later. A lock without pkg_hash pins a name and a version, not bytes, and the signer that builds releases refuses a tree on exactly that.

Proof
On real locks the check passes 9/9, 8/8, 7/7 and 29/29. A copy with a pkg_hash line stripped is now refused by name; so are an empty lock, a missing lock and a six-hex value. Terra PASSed the fix.

The branch also merges main (which carries this repository's workflow port) so the pin fast-forwards onto it.

P1e of the images-to-forge package (macula-io/martha#601), under DECIDED 2026-11-22 "images should move to forgejo". **What it pins** - `Containerfile`: both `FROM`s by `@sha256` at the `FROM` line. The tag stays beside each digest as a comment; the ARGs that carried the tag are gone. - `scripts/assert_rebar_lock_has_hashes.sh`, run from `.github/workflows/lint.yml` after the resolve: every hex package in `rebar.lock` must carry its `pkg_hash`, and the check fails when the lock names no package at all. **The second commit is the lock-check fix** The first version matched a checksum line by its shape, so a package's own blake2b line in `pkg_hash_ext` satisfied it after its `pkg_hash` was stripped: it said "all N packages carry their sha256" on a lock that carried none for that package. The fix follows the list headers (`{pkg_hash,[` only), needs 64 hex, and refuses a missing list. **Why** A tag can be moved, so a build that names one builds other bytes later. A lock without `pkg_hash` pins a name and a version, not bytes, and the signer that builds releases refuses a tree on exactly that. **Proof** On real locks the check passes 9/9, 8/8, 7/7 and 29/29. A copy with a `pkg_hash` line stripped is now refused by name; so are an empty lock, a missing lock and a six-hex value. Terra PASSed the fix. The branch also merges `main` (which carries this repository's workflow port) so the pin fast-forwards onto it.
The check found a checksum line by its shape, so the same package name in
pkg_hash_ext — a blake2b digest, not the sha256 the signer checks — satisfied
it. On this repository's own lock, with one package's pkg_hash line removed and
its pkg_hash_ext line left in place, it answered "all packages carry their
sha256".

It now follows the list headers: only lines under {pkg_hash,[ count, the value
must be 64 hex digits, and a lock with no pkg_hash list at all is refused too.
Proved on this repository's lock (every package carries its sha256) and on the
stripped copy above, which it now refuses by name, plus an empty file, a
missing file and a 6-digit value.
Merge forge main into pluto/p1-pin (images-to-forge P1e, macula-io/martha#601)
Some checks failed
c4 model / c4-model (pull_request) Successful in 0s
c4 model / c4-model-1 (pull_request) Successful in 4s
lint-and-test / check (pull_request) Failing after 4s
583b8e067f
ci: the container job checks out in plain shell, no marketplace action (macula-io/martha#601)
Some checks failed
lint-and-test / check (pull_request) Failing after 2m8s
c4 model / c4-model-1 (pull_request) Successful in 3s
c4 model / c4-model (pull_request) Successful in 0s
11d1fa5711
actions/checkout@v4 is a JavaScript action, and this job runs in its own
container — a macula-ci image, which carries no node — so the action died at
step 0 with exitcode 127 ("node": executable file not found).

The replacement step is BYTE-IDENTICAL in every repository on the forge: the
token reaches git through GIT_CONFIG_COUNT/GIT_CONFIG_KEY_0/GIT_CONFIG_VALUE_0
(http.extraHeader) in the environment, never through a URL or on a command
line; the run's own sha is fetched and checked out; and the step refuses any
tree that is not that sha. It is also the candidate for option B, one script
baked into macula-ci-images (a follow-up there, not tonight).

This follows the no-marketplace CI rule (DECIDED 2026-11-22 "do both").
test: the image pin test reads the builder FROM, which now carries the digest (macula-io/martha#601)
Some checks failed
c4 model / c4-model-1 (pull_request) Successful in 5s
c4 model / c4-model (pull_request) Successful in 0s
lint-and-test / check (pull_request) Successful in 2m47s
build-and-push / check (push) Successful in 1m48s
build-and-push / guard-1 (push) Has been skipped
build-and-push / guard (push) Successful in 0s
c4 model / c4-model-1 (push) Successful in 5s
c4 model / c4-model (push) Successful in 0s
build-and-push / test (push) Successful in 0s
lint-and-test / check (push) Successful in 1m46s
build-and-push / build-and-push (push) Has been skipped
build-and-push / attest (push) Failing after 0s
build-and-push / promote-latest (push) Failing after 0s
d8f6e484ff
P1e pinned the image by digest at the FROM line and removed the CI_OTP ARG this
test read, so the read matched nothing and the test badmatched at pinned/2. It now
reads "FROM (ghcr\.io/\S+) AS builder" — the builder stage, not the runtime one —
and still requires lint.yml to name the identical reference, digest and all.
Proved against this repository's files with erl, and by eunit running this one test
green; a lint.yml with one digest character changed fails the comparison.
Some checks failed
c4 model / c4-model-1 (pull_request) Successful in 5s
c4 model / c4-model (pull_request) Successful in 0s
lint-and-test / check (pull_request) Successful in 2m47s
build-and-push / check (push) Successful in 1m48s
build-and-push / guard-1 (push) Has been skipped
build-and-push / guard (push) Successful in 0s
c4 model / c4-model-1 (push) Successful in 5s
c4 model / c4-model (push) Successful in 0s
build-and-push / test (push) Successful in 0s
lint-and-test / check (push) Successful in 1m46s
build-and-push / build-and-push (push) Has been skipped
build-and-push / attest (push) Failing after 0s
build-and-push / promote-latest (push) Failing after 0s
This branch is already included in the target branch. There is nothing to merge.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin pluto/p1-pin:pluto/p1-pin
git switch pluto/p1-pin
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
macula-services/mcl-mpong!1
No description provided.