Skip to content

Workflow verify published

github-actions[bot] edited this page Nov 2, 2026 · 7 revisions

verify-published

What it does. Verifies a published image from the outside, the way an operator would: cosign verify for the signature, cosign verify-attestation --type spdxjson for the SBOM, gh attestation verify for provenance, then each platform pulled and your test-command run against it ($IMAGE there is the verified repo@sha256:... digest, never the tag, so what runs is what was verified). Set release-tag and it verifies a GitHub release the same way: every asset against SHA256SUMS, build provenance for every file, and (unless verify-release-sbom is false) the two SBOMs a Python package release carries. A final Verified job is the gate. It stops at the first failure. With rescan: true it also asks what verification cannot: whether an advisory has been published since the release (see below).

Why it exists. The producer signs, attaches an SBOM and records provenance, and nothing proved those verify from outside. A signature nobody checks is a claim. Run it nightly and a release that stops verifying is a red job, not a surprise.

Jobs and trust boundaries

verify has contents: read and packages: read. No secret, no Doppler, no id-token. A verifier that needs a credential is trusting something. A platform that differs from the runner's (arm64 on the x86 runner) runs under QEMU, set up only then.

A minimal caller

on:
  schedule:
    - cron: "17 5 * * *"
  workflow_dispatch:

jobs:
  verify:
    uses: ChiefGyk3D/git-your-ship-together/.github/workflows/verify-published.yml@<sha> # vX.Y.Z
    permissions:
      contents: read
      packages: read
    with:
      image: ghcr.io/OWNER/IMAGE:latest
      test-command: docker run --rm "$IMAGE" --version

A digest is stronger than a tag. The default identity-regexp matches any workflow in the maintainer's repositories and so matches an image from container-release; narrow it to one workflow with a pattern like ^https://github.com/ChiefGyk3D/git-your-ship-together/\.github/workflows/container-release\.yml@refs/tags/v. A fork should change the default, which names the maintainer. The allow-list was measured in block mode: this repository's fixture verify job refused GitHub's attestation store until its blob host was added.

Which repository built the image

The identity regexp can only name the reusable workflow that signed, and every repository calling container-release gets a certificate with that same subject. What differs is the certificate's repository claim, which is the calling repository. Both cosign commands pass it as --certificate-github-workflow-repository, set from source-repository:

  • Empty (the default) is the calling repository, so a repository verifying its own image needs no change.
  • An image built by another repository needs source-repository: OWNER/NAME; without it the check fails, by design. This repository's own fixture verify job does this for the star-daemon image.
  • Exact and case-sensitive, the spelling GitHub reports (ChiefGyk3D/Star-Daemon, not chiefgyk3d/star-daemon). The value must match ^[A-Za-z0-9._-]+/[A-Za-z0-9._-]+$ and reaches cosign through the environment only.

Measured with cosign v3.1.4 against the published star-daemon image: the right repository verifies both the signature and the SBOM attestation; a different repository, or the right one in the wrong case, fails both.

The post-release rescan

Verification proves an artefact is what the producer published. It says nothing about what has been reported against it since. rescan: true adds a rescan job that runs only if verification did not fail:

  • What it reads. Each platform in platforms of image, pulled by Trivy from the registry (no Docker, no QEMU), and sbom.cdx.json from the release release-tag, the SBOM python-package-release attaches. A release with no sbom.cdx.json fails the rescan rather than passing it.
  • Bound to what was verified. The verify job resolves the image to its digest first and runs the signature, SBOM and provenance checks against repo@sha256:...; the rescan scans that digest, never the tag, so a tag that moves between jobs is not scanned unverified. The release SBOM is the file verify-release checked, carried to the rescan as a one-day workflow artifact with its sha256; the rescan fails if the hash differs and never downloads the release a second time. An empty platforms list fails the rescan (no image scan ran) rather than passing.
  • What it fails on. Findings at rescan-severity (CRITICAL,HIGH), with unfixed advisories skipped, using Trivy's exit code: rescan-exit-code: "1" fails, "0" reports only. Both halves are scanned before the step fails, and a Trivy error fails it too. The table is in the job log.
  • What it cannot find. An advisory nobody has published, a package missing from the SBOM, or anything in code you wrote. A third-party SBOM matches less well than one Trivy generated, so the image scan is the stronger of the two.
  • The pin. Trivy is a binary checked against trivy-sha256, not an action. It needs no new egress host: the database comes from mirror.gcr.io or ghcr.io, and the version check is switched off.
  • Accepted advisories. rescan-ignore-advisories takes CVE and GHSA IDs and writes them to a .trivyignore; anything else is refused. Each ID needs an entry for your repository in baseline/risk-register.yaml with trivy in where. The weekly audit reads the input in your workflows and fails on an ID with no entry or a passed review date, as it does for pip-audit.

It is a rescan only if the caller schedules it. The caller above already has the nightly schedule:; add rescan: true and, for a release, release-tag.

Where the SARIF goes. The reports (*.sarif, *.txt, one per platform and one for the release) are a workflow artifact named rescan-artifact-name, kept 14 days. They are not uploaded to the Security tab by the workflow: that needs security-events: write, and a called workflow that asks for a permission its caller did not grant fails at startup for every caller, including the ones that never opted in. A caller that wants the Security tab adds a job of its own, one upload per file with its own category:

  upload:
    needs: verify
    if: always()
    runs-on: ubuntu-24.04
    permissions:
      contents: read
      security-events: write
    steps:
      - uses: actions/download-artifact@<sha> # vX.Y.Z
        with:
          name: verify-published-rescan
          path: rescan
      - uses: github/codeql-action/upload-sarif@<sha> # vX.Y.Z
        with:
          sarif_file: rescan/image-linux-amd64.sarif
          category: verify-published-rescan-image-amd64

Proved to fail. tests/test_verify_published.py runs the scan step against a fake trivy for the flags and exit codes, and the rescan-live CI job runs the real pinned Trivy over an SBOM naming a package with known critical advisories: the step goes red, naming them, and goes green again once they are all accepted. The fixture rescan job calls the workflow itself, in block mode, over this repository's published image.

Inputs (24), read from verify-published.yml:

Input Type Default Meaning
image string empty Image reference to verify, for example ghcr.io/chiefgyk3d/star-daemon:latest. A digest reference is stronger than a tag. Empty skips the image checks; set this, release-tag or both.
release-tag string empty GitHub release tag whose assets are verified (checksums, build provenance and, by default, the SBOMs). Empty skips the release checks.
release-repository string empty owner/name holding the release; empty means the calling repository.
verify-release-sbom boolean true Require sbom.cdx.json and sbom.spdx.json among the release assets, listed in SHA256SUMS and of the format they claim. Turn off for a release made by artifact-release.yml, which does not write them.
identity-regexp string ^https://github.com/ChiefGyk3D/ Regular expression the cosign certificate identity must match. Both cosign commands use it.
source-repository string empty owner/name of the repository whose workflow built and signed the image; the signing certificate must name it. Empty means the calling repository, which is right when a repository verifies its own image. Set it when the image was built by another repository. The comparison is exact and case-sensitive, so use the repository's own spelling.
oidc-issuer string https://token.actions.githubusercontent.com OIDC issuer the signing certificate must name.
verify-sbom boolean true Verify the SPDX SBOM attestation with cosign verify-attestation --type spdxjson.
verify-provenance boolean true Verify the SLSA build provenance with gh attestation verify, for the owner in the image reference.
test-command string empty Shell run once per platform against the pulled image; $IMAGE is the verified digest reference (repo@sha256:...), never the tag, and DOCKER_DEFAULT_PLATFORM is set. Empty skips the check.
rescan boolean false Rescan the verified image (every platform) and the release's sbom.cdx.json with Trivy for advisories published since release. Findings at or above rescan-severity fail the run unless rescan-exit-code is "0". Runs only when the verification itself passed. Off by default.
rescan-severity string CRITICAL,HIGH Severities the rescan reports and fails on, comma-separated.
rescan-exit-code string 1 Trivy exit code when the rescan finds something. "1" (the default, the same as trivy-exit-code in container-release.yml) fails the job; "0" reports only.
rescan-ignore-unfixed boolean true Skip advisories that have no fixed version yet, so a finding the maintainers cannot act on does not fail a nightly run.
rescan-ignore-advisories string empty Comma-separated advisory IDs (CVE-..., GHSA-...) the rescan does not fail on. Each one needs an entry for the calling repository in the shared repository's baseline/risk-register.yaml with trivy in where; the weekly audit reads this input and fails on an ID that has none, or whose review date has passed.
rescan-artifact-name string verify-published-rescan Name of the workflow artifact that carries the rescan's SARIF and text reports. A caller that calls this workflow twice in one run gives each call its own name.
trivy-version string 0.76.1 Trivy release to download (aquasecurity/trivy), without the v; the one Trivy pin in this workflow. Changing it means changing trivy-sha256. To bump - gh release download v<new> -R aquasecurity/trivy -p 'trivy_<new>_Linux-64bit.tar.gz' -p 'trivy_<new>_checksums.txt', sha256sum the archive and compare the line in the checksums file.
trivy-sha256 string c7cbe3137fb8a48a17574bede3dd6beb16742d1e9772929940fc90082c39d9c0 sha256 of trivy_<trivy-version>_Linux-64bit.tar.gz. The download is refused when it does not match.
platforms string linux/amd64,linux/arm64 Comma-separated platforms to pull and test. A platform that differs from the runner's runs under QEMU.
egress-policy string block harden-runner egress policy - audit logs outbound connections, block allows only allowed-endpoints. Jobs that hold no secret follow egress-policy-secretless instead (EX-0001).
egress-policy-secretless string block harden-runner egress policy for the jobs that hold no stored secret, no OIDC token and no write-scoped or publish-capable token (read-only contents, a SARIF upload at most), and whose output no privileged job consumes - exactly audit or block. Defaults to block since security exception EX-0001 (GitHub-hosted runners in westus2 broke harden-runner block) was closed on 2026-11-02 after harden-runner v2.22.3 passed on westus2; see docs/security/exceptions/. Every job still has the default read-only job token. Set audit to opt out if the defect recurs. Any other job follows egress-policy. Any other value fails the job.
allowed-endpoints string api.github.com:443 auth.docker.io:443 fulcio.sigstore.dev:443 ghcr.io:443 github.com:443 index.docker.io:443 mirror.gcr.io:443 pkg-containers.githubusercontent.com:443 production.cloudfront.docker.com:443 raw.githubusercontent.com:443 registry-1.docker.io:443 rekor.sigstore.dev:443 release-assets.githubusercontent.com:443 timestamp.sigstore.dev:443 tmaproduction.blob.core.windows.net:443 tuf-repo-cdn.sigstore.dev:443 harden-runner allow-list for block, space-separated host:port entries. Wildcards are not supported and a newline-separated list matches nothing.
extra-allowed-endpoints string empty Appended to allowed-endpoints, for hosts only this image or test command reaches. Same format.
timeout-minutes number 20 Job timeout. Pulling and running an emulated platform is slow.

What it refuses to do

It never holds a credential, never passes when verification failed (the Verified job fails unless the verification succeeded), and never changes anything it verifies.

Clone this wiki locally