Skip to content

fix(ci): verify cosign signature on seed image in rebuild-rpms - #180

Closed
mrbobbytables wants to merge 1 commit into
projectbluefin:mainfrom
mrbobbytables:sec/verify-seed-image-cosign
Closed

mrbobbytables wants to merge 1 commit into
projectbluefin:mainfrom
mrbobbytables:sec/verify-seed-image-cosign

Conversation

@mrbobbytables

Copy link
Copy Markdown
Contributor

Summary

In .github/workflows/rebuild-rpms.yml, the publish job's step "Seed repository from the last published factory image" pulled ghcr.io/<owner>/utah-packages:latest and extracted its RPMs into repository/ without verifying the image signature or provenance attestation.

This change:

  • Verifies the downloaded cosign v2.4.1 binary checksum and installs it prior to pulling the seed image.
  • Verifies the actual pulled digest against the repository workflow's keyless OIDC identity (^https://github.com/${{ github.repository }}/\.github/workflows/rebuild-rpms\.yml@refs/heads/main$) and certificate issuer before creating the container or copying RPMs out of it.
  • Pins extraction to the verified digest (ghcr.io/<owner>/utah-packages@<digest>).
  • Adds a unit test in tests/test_atomic_publish.py asserting that the seed step verifies the cosign signature against OIDC parameters.
  • Documents the cosign verify failure classification and triage guidance in .agents/skills/build-failure-triage/SKILL.md.

Fixes #173

— hive: backend=copilot model=gemini-3.8-flash

🐝 Hive Agent: contributor | SHA: 57fcdbe

Verify the pulled ghcr.io/<owner>/utah-packages:latest seed image against the
workflow's keyless OIDC identity before extracting RPMs into the repository.
Verify against the exact pulled digest to prevent tag mutation, add a unit
test verifying the seed verification step, and document triage guidance in
the build-failure-triage skill.

Fixes projectbluefin#173

Assisted-by: Gemini 3.8 Flash via GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>

@castrojo castrojo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Substantive review:

  • Security hardening: In rebuild-rpms.yml publish job, downloads and checksum-verifies cosign v2.4.1 binary and performs keyless cosign verification against the pulled image digest and main branch OIDC identity before container extraction.
  • Test Enforcement: Adds test_seed_step_verifies_cosign_signature in tests/test_atomic_publish.py to assert cosign verification.
  • Validation: Factory contract, validate.py, and unittest suite pass without errors.
  • Outstanding: CI rebuild matrix jobs are currently queued/running; awaiting CI completion and independent peer review (+2).

@hanthor

hanthor commented Sep 20, 2026

Copy link
Copy Markdown
Member

Closing to consolidate the queue on the merged #178 full-factory candidate. The branch is retained; please re-open or submit a fresh, rebased PR after that build establishes the current baseline.

@hanthor hanthor closed this Sep 20, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correctness

  • (low) cosign verify in the seed step runs with no registry credentials: the step's podman login (.github/workflows/rebuild-rpms.yml:572) writes podman's auth file, but cosign reads the Docker config — the quirk this same workflow documents and works around with DOCKER_CONFIG on the sign step (rebuild-rpms.yml:706–709, 738–744). It works today only because the GHCR package is publicly readable (verified anonymously). If the package ever goes private, the publish job hard-fails at verify with an auth error that the new SKILL.md triage row (line 160) misclassifies as tampering. Consider setting DOCKER_CONFIG + --authfile on this step the same way the publish/sign steps do.

Verified live at head 57fcdbe: the current :latest digest's cosign cert SAN is exactly https://github.com/projectbluefin/utah-packages/.github/workflows/rebuild-rpms.yml@refs/heads/main with issuer https://token.actions.githubusercontent.com, so the pinned regexp matches and the next main publish won't brick. tests/test_atomic_publish.py (10 tests) passes at head.

No findings from: security, intent-alignment, style, docs-currency.

— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.78

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[sec-check] rebuild-rpms.yml seed step consumes ghcr :latest without cosign verification — poisoned RPMs would be carried forward and re-signed

3 participants