Repository navigation
fix(ci): verify cosign signature before seeding from the factory image - #215
Merged
castrojo merged 2 commits intoSep 23, 2026
Merged
Conversation
Danathar
force-pushed
the
sec/cosign-verify-seed-image
branch
from
September 20, 2026 19:53
a77a759 to
d7fdb3c
Compare
castrojo
reviewed
Sep 21, 2026
castrojo
left a comment
Contributor
There was a problem hiding this comment.
Reviewed: Properly verifies cosign signature before seeding from the factory OCI image in .github/workflows/rebuild-rpms.yml, and adds test coverage in tests/test_atomic_publish.py with documentation updates in docs/skills/repeated-mistakes.md. Clean trial merge against origin/main, passes factory contract check and test suite (416 passed, 2127 subtests passed). Awaiting second independent human review to satisfy merge policy.
The publish job's seed step pulled ghcr.io/<owner>/utah-packages:latest (or
the branch tag) and copied every RPM out of it without checking the cosign
signature this same workflow attaches to the image it publishes ('Sign the
published image' + actions/attest-build-provenance). Anyone able to push to
the GHCR package once -- a leaked token, a compromised workflow with
packages: write, or a registry-side compromise -- could plant RPMs in the
mutable tag and have every subsequent run copy them forward, sign
repomd.xml over them, publish a new signed image, and attest provenance for
it, laundering an unverified input into a verified one. The existing
staleness check (comparing against needs.prepare.outputs.factory_image) does
not catch this: it only detects the tag moving mid-run, not a bad image
already being current.
Install cosign before the seed step and verify the digest actually pulled
(never the mutable tag, which can move again after the check) against this
workflow's own keyless OIDC identity -- refs/heads/main when the seed came
from :latest, the current branch ref when it came from the branch tag --
before creating a container or copying anything out of it. Log in with an
authfile that matches DOCKER_CONFIG, the same auth-store split the publish
step's comment already documents, so cosign verify actually sees the
credentials the pull used.
Add regression tests asserting the seed step calls cosign verify with an
OIDC issuer and identity, verifies the resolved digest rather than a bare
tag, does so before podman cp, is installed ahead of the seed step, and
logs in where cosign will look. Document the new cosign-verify-failure
triage entry in build-failure-triage, and the underlying rule -- freshness
is not trust -- in repeated-mistakes.
Verified against the live image:
cosign verify ghcr.io/projectbluefin/utah-packages:latest \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
--certificate-identity https://github.com/projectbluefin/utah-packages/.github/workflows/rebuild-rpms.yml@refs/heads/main
succeeds, so the identity this change pins matches how the workflow already
signs.
Fixes projectbluefin#173
Assisted-by: Claude Sonnet 5 via hive
Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Danathar <Danathar@users.noreply.github.com>
castrojo
force-pushed
the
sec/cosign-verify-seed-image
branch
from
September 21, 2026 03:06
d7fdb3c to
d3faad7
Compare
hanthor
approved these changes
Sep 23, 2026
hanthor
left a comment
Member
There was a problem hiding this comment.
Reviewed: cosign verify-before-seed in rebuild-rpms.yml plus skill doc. CI 3/3 green, CLEAN, bot no-findings, diff inspected. Good to merge once a second human confirms (per castrojo's note).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #180 (same fix against #173), which hanthor closed on 2026-09-20
asking for "a fresh, rebased PR after that build establishes the current
baseline." #178 is merged; this branches from
ef320c1(currentmain).Summary
In
.github/workflows/rebuild-rpms.yml, thepublishjob's seed step("Verify and seed repository from the prepare-time factory image") pulled
ghcr.io/<owner>/utah-packages:latest(or the current branch's own tag) andextracted every RPM in it into
repository/without checking the cosignsignature this same workflow attaches to the image it publishes ("Sign the
published image" +
actions/attest-build-provenance).Anyone able to push to the
utah-packagesGHCR package once — a leakedtoken, a compromised workflow holding
packages: write, or a registry-sidecompromise — could plant RPMs in the mutable tag and have every subsequent
run copy them forward, sign
repomd.xmlover them, publish a new signedimage, and attest provenance for it. The factory would launder an unverified
input into a verified one; the existing staleness check (comparing against
needs.prepare.outputs.factory_image) does not catch this because it onlydetects the tag moving mid-run, not a bad image being present in the first
place.
Change
the job) before the seed step; the later re-install stays, since it is a
harmless no-op and keeping it avoids coupling the sign-blob step to a side
effect of an earlier, unrelated step.
latestvs. the branch tag) and pullingby digest, verifies
cosign verifyagainst this workflow's own keylessOIDC identity —
refs/heads/mainwhen the seed came fromlatest, thecurrent ref otherwise — before creating a container or copying anything out
of it. Verification runs on the digest actually pulled, never the mutable
tag, so the tag cannot move between verification and extraction.
--authfile "$DOCKER_CONFIG/config.json"so cosign(which reads the Docker config, not podman's own auth store — see the
existing comment on the "Publish the repository" step) actually sees the
credentials the pull used.
tests/test_atomic_publish.pyasserting the seedstep calls
cosign verifywith an OIDC issuer and certificate identity,verifies the resolved digest rather than a bare tag, does so before
podman cp, logs in where cosign will look, and that cosign is installedbefore the seed step runs.
cosign verifyfailure mode in.agents/skills/build-failure-triage/SKILL.md, and the underlying rule("freshness is not trust") as entry 16 in
docs/skills/repeated-mistakes.md.Verification
python3 -m unittest discover -s tests— 416 tests, all pass (includingthe 5 new regression tests).
python3 tools/check_workflow_quoting.py— clean.python3 tools/factory_contract.py/python3 tools/validate.py— bothsatisfied.
image with the exact identity this change now enforces:
:latest(verified offline against thetransparency log, signed by this repository's
rebuild-rpms.ymlonrefs/heads/main, per the returned certificate claims), confirming thenext scheduled
publishrun will not be broken by this check.Fixes #173
— hive: backend=omp model=anthropic/claude-sonnet-5 effort=medium