Skip to content

Add cosigning and provenance attestation to image builds#2073

Open
averevki wants to merge 1 commit into
mainfrom
builds-cosigning-and-provenance
Open

Add cosigning and provenance attestation to image builds#2073
averevki wants to merge 1 commit into
mainfrom
builds-cosigning-and-provenance

Conversation

@averevki

@averevki averevki commented Jun 30, 2026

Copy link
Copy Markdown
Member

Summary

Part of the work on #2038

Context

This improves the Signed-Releases (https://github.com/ossf/scorecard/blob/main/docs/checks.md#signed-releases) check from the OpenSSF Scorecard (https://scorecard.dev/). Merging this should bring this section score from current 0 to 10.

Verification

Building workflows with the new changes were executed on my fork of the kuadrant-operator, and the successful run can be found here, with the images pushed here

Summary by CodeRabbit

  • New Features
    • Container images now include provenance details and are signed before release, improving trust in published builds.
    • Release workflows now support signing and attestation for operator, bundle, and catalog images.
  • Security
    • Added stronger identity and permission settings for image publishing jobs to support secure signing.

Signed-off-by: averevki <sandyverevkin@gmail.com>
@averevki averevki self-assigned this Jun 30, 2026
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Cosign image signing and provenance attestation are added to operator, bundle, and catalog image builds. The base reusable workflow enables Docker provenance and appends cosign signing steps. The tag-release workflow gains full cosign sign and actions/attest attestation flows, gated on the repository owner. Branch, main, and nightly workflows gain id-token: write permissions to support OIDC-based signing.

Changes

Image Signing and Provenance

Layer / File(s) Summary
OIDC permissions for branch/main/nightly
.github/workflows/build-images-branches.yaml, .github/workflows/build-images-main.yaml, .github/workflows/build-images-nightly.yaml
Adds id-token: write and contents: read job-level permissions to workflow-build in all three caller workflows.
Provenance and cosign signing in base workflow
.github/workflows/build-images-base.yaml
Sets provenance: true on all three image build-push steps and appends cosign install and cosign sign --yes steps for operator, bundle, and catalog images.
Signing and attestation in tag-release workflow
.github/workflows/build-images-for-tag-release.yaml
Adds id-token: write and attestations: write permissions to all three build jobs; appends conditional cosign registry login, cosign install, cosign sign --yes, and actions/attest provenance steps for each image.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 A signature here, a digest there,
Cosign hops in with cryptographic flair,
Provenance set true, attestations in tow,
Each image is signed with a neat little bow,
No imposter shall pass — the rabbit said so! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding cosigning and provenance attestation to image builds.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch builds-cosigning-and-provenance

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.99%. Comparing base (5519dbf) to head (46676fa).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2073      +/-   ##
==========================================
- Coverage   75.08%   74.99%   -0.10%     
==========================================
  Files         127      127              
  Lines       12632    12632              
==========================================
- Hits         9485     9473      -12     
- Misses       2665     2670       +5     
- Partials      482      489       +7     
Flag Coverage Δ
bare-k8s-integration 20.10% <ø> (-0.05%) ⬇️
controllers-integration 53.47% <ø> (-0.06%) ⬇️
envoygateway-integration 40.94% <ø> (+0.21%) ⬆️
gatewayapi-integration 16.10% <ø> (+0.09%) ⬆️
istio-integration 44.74% <ø> (-0.15%) ⬇️
unit 28.68% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
api (u) 85.88% <ø> (ø)
internal (u) 76.41% <ø> (-0.11%) ⬇️
pkg (u) 39.13% <ø> (ø)
see 12 files with indirect coverage changes
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
.github/workflows/build-images-base.yaml (1)

161-165: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Declare least-privilege permissions inside the reusable workflow jobs.

The callers now pass contents: read and id-token: write, but these signing jobs still omit their own permissions blocks. Add the same minimal scopes to each job that checks out code and signs images so future callers cannot accidentally run this reusable workflow with broader default token permissions.

🔒 Proposed hardening
   build:
     name: Build
     runs-on: ubuntu-latest
+    permissions:
+      contents: read
+      id-token: write
     steps:
   build-bundle:
     needs: build
     name: Build Bundle
     runs-on: ubuntu-latest
+    permissions:
+      contents: read
+      id-token: write
     steps:
   build-catalog:
     name: Build Catalog
     needs: [build, build-bundle]
     runs-on: ubuntu-latest
+    permissions:
+      contents: read
+      id-token: write
     steps:

Also applies to: 224-228, 280-284

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/build-images-base.yaml around lines 161 - 165, Add
explicit least-privilege permissions to each reusable workflow job that performs
checkout and image signing, instead of relying on caller defaults. Update the
jobs containing the “Install cosign” and “Sign image with cosign” steps to
declare the same minimal scopes, using the job-level permissions block so future
callers cannot inherit broader token access. Apply the same hardening to the
other matching signing jobs referenced by the workflow.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In @.github/workflows/build-images-base.yaml:
- Around line 161-165: Add explicit least-privilege permissions to each reusable
workflow job that performs checkout and image signing, instead of relying on
caller defaults. Update the jobs containing the “Install cosign” and “Sign image
with cosign” steps to declare the same minimal scopes, using the job-level
permissions block so future callers cannot inherit broader token access. Apply
the same hardening to the other matching signing jobs referenced by the
workflow.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 28438a18-b051-4c20-874f-ef15b7ad7e62

📥 Commits

Reviewing files that changed from the base of the PR and between 4c28522 and 46676fa.

📒 Files selected for processing (5)
  • .github/workflows/build-images-base.yaml
  • .github/workflows/build-images-branches.yaml
  • .github/workflows/build-images-for-tag-release.yaml
  • .github/workflows/build-images-main.yaml
  • .github/workflows/build-images-nightly.yaml

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants