Repository navigation
ci: attest, sign and scan published images - #256
Conversation
Scan the image of every pull request with Trivy, through the shared composite action `.github/actions/scan-image` (as in cloud-registry), and upload the findings that have a fix to code scanning. On pushes to `dev`, push the image by digest, untagged, with SBOM and provenance attestations, scan exactly that digest in a job without credentials or signing identity, and only then attest its provenance, sign it with Sigstore keyless signing and tag it `dev` and `sha-<commit>`, checking that each tag resolves to the signed digest. Scan `latest` weekly (`scan.yaml`), keeping a full report, also of the findings without a fix, as a workflow artifact. Accept the pip-vendored findings of the base image in `.trivyignore.yaml`, with reasons and expiry dates, and let Dependabot update the composite action too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Push the release image by digest with SBOM and provenance attestations, scan exactly that digest in a job of its own, without the release credentials, the `contents: write` token and the signing identity, and only then attest its build provenance, sign it (Sigstore keyless) and tag it. Attest the chart's provenance and attach a Sigstore bundle of its signature (`.tgz.sigstore.json`) to the release. As in cloud-registry; the publishing job alone gets `id-token: write` and `attestations: write`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add "Verifying images and charts" to the operations page: how to check the GitHub artifact attestations and Sigstore signatures of release and `dev` images and of the released chart, and how to read an image's SBOM and provenance. Describe the scan, attest and sign steps of the release and the image scans in the development docs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Take the scan action of elixir-cloud-aai/cloud-registry#202 (fixable findings to code scanning; the weekly full report as JSON and as a table), so that the copies in FOCA, cloud-registry and proTES stay identical, and align the docs with it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Take the scan job comment of cloud-registry `dev` verbatim, and rewrap the scan paragraphs of the operations and development docs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideThe PR introduces a shared Trivy-based image scanning workflow and gates development and release publication on scanning exact immutable digests, then adds SBOM/provenance attestations, keyless image and chart signing, and verification documentation. Sequence diagram for digest scanning and signed image publicationsequenceDiagram
participant Workflow as GitHub Actions
participant Registry as Docker Hub
participant Scanner as Trivy scan
participant Attestor as Provenance attestation
participant Cosign as Cosign
Workflow->>Registry: Build and push image by digest
Workflow->>Scanner: Scan image@digest
Scanner-->>Workflow: Pass or fail on fixable HIGH/CRITICAL
alt scan passes
Workflow->>Attestor: Attest build provenance for digest
Workflow->>Cosign: cosign sign image@digest
Workflow->>Registry: Tag signed digest as dev or release tags
else scan fails
Workflow-->>Registry: Leave digest untagged and unsigned
end
Sequence diagram for signed Helm chart release artifactssequenceDiagram
participant Release as Release workflow
participant Attestor as GitHub attestation
participant Cosign as Cosign
participant GitHub as GitHub release
Release->>Attestor: Attest chart provenance
Release->>Cosign: cosign sign-blob chart.tgz
Cosign-->>Release: Write chart.tgz.sigstore.json
Release->>GitHub: Attach chart and Sigstore bundle
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #256 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 26 26
Lines 1517 1517
=========================================
Hits 1517 1517 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path=".github/workflows/checks.yaml" line_range="483-484" />
<code_context>
+ for tag in "${IMAGE_NAME}:dev" "${IMAGE_NAME}:sha-${SHA}"; do
+ docker buildx imagetools create --tag "${tag}" "${IMAGE_NAME}@${DIGEST}"
+ actual="$(docker buildx imagetools inspect "${tag}" \
+ --format '{{ json .Manifest }}' | jq -r .digest)"
+ if [[ "${actual}" != "${DIGEST}" ]]; then
+ echo "::error::${tag} points to ${actual}, expected ${DIGEST}"
+ exit 1
</code_context>
<issue_to_address>
**Dev image publishing always fails**
When a push reaches the `Tag image` step, the `imagetools inspect` format serializes the OCI manifest or index, whose top-level data has no `digest` field. `jq -r .digest` therefore returns `null`, so the comparison fails after tagging and the `Publish app image` job reports failure on every push.
Read the digest from a registry descriptor or another inspect field that actually exposes the resolved digest, then compare that value with `DIGEST`.
</issue_to_address>
### Comment 2
<location path=".trivyignore.yaml" line_range="24-37" />
<code_context>
+ # copies without a path, so the entries can't be limited with `paths`; they
+ # would also hide these versions if installed normally
+ - id: CVE-2025-47273
+ purls: ["pkg:pypi/[email protected]"]
+ statement: Vendored by pip, not used by the app (path traversal in PackageIndex, which pip doesn't use)
+ expired_at: 2027-01-31
+ - id: CVE-2026-97687
+ purls: ["pkg:pypi/[email protected]"]
+ statement: Vendored by pip, not used by the app (pip only runs at build time)
+ expired_at: 2027-01-31
+ - id: CVE-2026-97689
</code_context>
<issue_to_address>
**Runtime vulnerabilities get ignored**
When a runtime dependency later includes one of the listed package versions with the corresponding vulnerability, trivy applies these vulnerability-ID/PURL ignores without checking whether the package is pip-vendored or installed for the app. If a runtime dependency later matches one of these entries, the scan passes and the image can be signed and tagged despite the vulnerability.
Remove the broad ignores by updating the base image’s vendored packages, or use path-scoped ignores if Trivy can identify the vendored paths.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 2 findings to address first, and if the digest or signing flow is wrong, CI could publish and sign an unintended image that consumers may deploy or trust; tags and signatures already pushed to the registry are not undone by reverting the workflow. The scan gate also changes what can be published, but a mistake there does not by itself create the vulnerabilities it fails to detect.
Blocking findings: .github/workflows/checks.yaml:484, .trivyignore.yaml:37
Summary
Attest, sign and scan the published images and the Helm chart, as in cloud-registry (elixir-cloud-aai/cloud-registry#181 and elixir-cloud-aai/cloud-registry#192):
.github/actions/scan-image/action.yml, verbatim from cloud-registrydev(8ce016b, ci: upload only fixable scan findings cloud-registry#202; same blob): fails on fixable critical and high findings, uploads only the findings that have a fix to code scanning, and withreport: "true"(weekly scan) keeps a full report (JSON and table), unfixed findings included, as a workflow artifact.checks.yaml): pull requests build the image locally and scan it. Pushes todevpush the image by digest, untagged, with SBOM and provenance attestations (mode=max) (Push app image), scan exactly<image>@<digest>in a job without credentials, signing identity orid-token(Scan image), and only then attest the build provenance (actions/attest-build-provenance, pushed to the registry), sign the digest with cosign (keyless) and tag itdevandsha-<commit>withimagetools create, checking that each tag resolves to the signed digest (Publish app image).id-token: writeandattestations: writeonly on that job.release.yaml): the same for release images (newscanjob betweenpushandpublish, both still approved in thereleaseenvironment), plus a provenance attestation and a Sigstore bundle (protes-X.Y.Z.tgz.sigstore.json, attached to the release) for the chart.scan.yaml) oflatest, withvars.DOCKERHUB_ORG || 'elixircloud', keeping the full report as an artifact..trivyignore.yaml: the four findings of pip's vendored copies in the base image (same as cloud-registry; checked againstelixircloud/protes:devwith Trivy 0.75.0: these are the only fixable high/critical findings, and msgpack/setuptools/urllib3 2.7.0 are not installed insite-packages), each with reason and expiry date.gh attestation verify,cosign verify,cosign verify-blob, SBOM and provenance); release steps (two approvals in thereleaseenvironment, scan between them, tags can't be moved) and the image scans in the development docs; index.Required checks: the
devruleset of proTES currently lists no required status checks, so no names change for it; existing job names are unchanged except the image job, which is nowPublish app image(as in cloud-registry), with the newPush app imageandScan image.Verification
pre-commit run --all-files(incl. actionlint, check-yaml, semgrep, ast-grep, mypy): passed.mkdocs build --strict: passed.pytest tests/test_build.py(Python version ofsetup-pythonin all workflows): passed.checks.yamlcompared with cloud-registrydev: identical apart from the image name; release workflow differs from cloud-registry only in the pre-existing, out-of-scope parts (release notes format, chart dependency handling).elixircloud/protes:dev(fixable high/critical): only the four ignored pip-vendored findings.Scan image(local build, fixable findings uploaded to code scanning,Trivycheck passed);Push app imageandPublish app imageare skipped on pull requests, as intended. Thedevpath (push by digest, scan, attest, sign, tag) runs on the merge todev.Full review lane (release workflow): adversarial and quality reviewer subagents, no high findings; fixed: comment/doc wrapping (now verbatim cloud-registry text).
Declined review findings
protes:latest, which is still the last pre-release-workflow image (pushed by the olddevworkflow before ci!: release from signed version tags #230 merged), unsigned, so the weekly scan may fail on its fixable findings until the first release. Kept as in cloud-registry:latestis what users pull, so scanning it is the point, and the first release replaces it. The reviewer's concern that stale branches keep pushinglatestdoes not hold: their old workflows trigger only on pushes todev(and pull requests, which never published).:latestis resolved by each Trivy run of the weekly scan, so a release during the scan could mix images. Kept identical to cloud-registry (shared action/workflow); a digest pin inscan.yamlwould be a change for all three repos.dev).report; kept identical to the shared action.jq -r .digestofimagetools inspect --format '{{ json .Manifest }}'would be null. It isn't:.Manifestis the descriptor, and it prints the index digest (checked onelixircloud/cloud-registry:dev, published by the same step).purlsto the exact versions and expire on 2027-01-31; same as cloud-registry and FOCA..trivyignore.yamlnote dated 2026-10-23 instead of 2026-10-22: checked for the proTES image on that date, so kept.Open questions
None.
Notes for the maintainers
Scan imageto the required checks ofdev(the proTES ruleset currently has none).docs/releases/notes exist yet; the first release's notes should mention signed images and chart.Closes #234
🤖 Generated with Claude Code