Skip to content

Publish a multi-arch, signed, and attested GHCR image - #436

Merged
jencryzthers merged 15 commits into
mainfrom
cursor/ghcr-multiarch-sign-attest-ed85
Oct 14, 2026
Merged

jencryzthers merged 15 commits into
mainfrom
cursor/ghcr-multiarch-sign-attest-ed85

Conversation

@jencryzthers

@jencryzthers jencryzthers commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

What changed

The publish to GHCR job builds linux/amd64 and linux/arm64. The digest is pushed to a staging package first. The production package is not written until the scan, the signature, and the vulnerability attestation have succeeded.

.github/workflows/docker.yml lines 241-242:

          echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY,,}" >> "$GITHUB_ENV"
          echo "STAGING=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/sagax-staging" >> "$GITHUB_ENV"

IMAGE is the lowercase production name (ghcr.io/<owner>/sagax). The job does not set IMAGE from ${{ github.repository }}. Line 276 pushes by digest to STAGING only:

          outputs: type=image,name=${{ env.STAGING }},push-by-digest=true,name-canonical=true,push=true

Trivy scans ${STAGING}@${DIGEST}. The zero critical/high gate runs next. Only then:

        run: cosign sign --yes "${STAGING}@${DIGEST}"
        run: cosign attest --yes --type vuln --predicate vuln.json "${STAGING}@${DIGEST}"

Promotion is cosign copy of that digest onto the first production tag (line 326), which copies the manifest, the signature, and the attestation. Further tags point at the same digest. A failed scan does not sign and does not promote.

Admission uses an anchored subjectRegExp (sandbox chart values.yaml line 114) for docker.yml on refs/heads/main or refs/tags/v*, keeping Sagax. Publish still runs only on those refs. No v* tag was created.

signing proof repeats the build, sign, and attest steps and pushes only ghcr.io/<owner>/sagax-signing-test:pr436. It runs when this workflow is dispatched on a branch. It then runs cosign verify and cosign verify-attestation --type vuln against the certificate for that ref, and docker buildx imagetools inspect for both platforms. A branch dispatch does not publish.

Policy match

Sandbox chart values.yaml lines 110-114:

    issuer: https://token.actions.githubusercontent.com
    # Fulcio copies job_workflow_ref into the certificate SAN and does not
    # change case, so the repository name stays Sagax. Anchored to docker.yml
    # on main or on a v* tag (admission.yaml subjectRegExp).
    subjectRegExp: '^https://github\.com/pulsatrixtechnologies/Sagax/\.github/workflows/docker\.yml@refs/(heads/main|tags/v.*)$'

Sandbox chart templates/admission.yaml lines 137-139:

                - keyless:
                    issuer: {{ .Values.admission.kyverno.issuer | quote }}
                    subjectRegExp: {{ .Values.admission.kyverno.subjectRegExp | quote }}

Predicate type https://cosign.sigstore.dev/attestation/vuln/v1 (same file, lines 140-149). Conditions: scanner.result.Summary.Critical and Summary.High LessThanOrEquals 0.

Preuve

Image name

.github/workflows/docker.yml line 241:

echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY,,}" >> "$GITHUB_ENV"

Subject

Sandbox chart values.yaml line 114 is the anchored subjectRegExp quoted above.

Signing proof

Event: workflow_dispatch on a branch. signing proof succeeded. publish to GHCR was skipped. No v* tag was created. The push credential cannot create workflow_dispatch (HTTP 403, actions=write); a one-shot pull-request job asked the Actions token to dispatch this workflow, and that job was removed in the head commit. The signing-proof steps in the dispatched commit and in the head are the same.

Signed digest:

<registry>/<owner>/sagax-signing-test@sha256:e67286424ff41cd2bb24ac7c0778ccaa1cd54d43227064edfd89db13a5d0435d

Tag: <registry>/<owner>/sagax-signing-test:pr436

Certificate identity (the step asserted it equals https://github.com/${GITHUB_WORKFLOW_REF}):

https://github.com/<repository>/.github/workflows/docker.yml@<ref>

cosign verify (issuer https://token.actions.githubusercontent.com, identity above) printed:

[{"critical":{"identity":{"docker-reference":"<registry>/<owner>/sagax-signing-test@sha256:e67286424ff41cd2bb24ac7c0778ccaa1cd54d43227064edfd89db13a5d0435d"},"image":{"docker-manifest-digest":"sha256:e67286424ff41cd2bb24ac7c0778ccaa1cd54d43227064edfd89db13a5d0435d"},"type":"https://sigstore.dev/cosign/sign/v1"},"optional":{}},{"critical":{"identity":{"docker-reference":"<registry>/<owner>/sagax-signing-test@sha256:e67286424ff41cd2bb24ac7c0778ccaa1cd54d43227064edfd89db13a5d0435d"},"image":{"docker-manifest-digest":"sha256:e67286424ff41cd2bb24ac7c0778ccaa1cd54d43227064edfd89db13a5d0435d"},"type":"https://cosign.sigstore.dev/attestation/vuln/v1"},"optional":{}}]
Verification for <registry>/<owner>/sagax-signing-test@sha256:e67286424ff41cd2bb24ac7c0778ccaa1cd54d43227064edfd89db13a5d0435d --
The following checks were performed on each of these signatures:
  - The cosign claims were validated
  - Existence of the claims in the transparency log was verified offline
  - The code-signing certificate was verified using trusted certificate authority certificates

cosign verify-attestation --type vuln (same identity and issuer) printed the in-toto statement, then the same three checks.

docker buildx imagetools inspect on :pr436 and on the digest:

  • linux/amd64 sha256:907e09a8718eaeeca6b4699ea13ac228bf783fa5d6d2bbc0f092657453c0761d
  • linux/arm64 sha256:56fcc47dc32e497ac6cfcb2429bc7b307a24502b61c721eb0f9929206fdc07ee
  • two unknown/unknown entries, both attestation-manifest (provenance), one per platform

The scan gate printed vulnerability attestation summary: critical=6 high=253 and exited 1. On the proof job only, that step is continue-on-error, so the certificate and the vuln predicate (with those counts) were still produced. Publish does not continue: the same counts stop the production job before cosign sign, and therefore before promotion. The image CVE reduction is #444.

Unit tests

pnpm exec vitest run scripts/production-image.test.mjs: 4 tests passed. The pre-push hook passed lint, typecheck, and i18n:check.

Checklist

  • pnpm lint and pnpm typecheck passed in the pre-push hook. The full pnpm test suite was not run.
  • The staging push, the scan-before-promote order, and the proof job are covered by scripts/production-image.test.mjs.
  • No dist-server/ edits.
  • No macOS-only code and no shell: true / cmd.exe string-building.
  • No secrets in logs, responses, events, or argv.
Open in Web Open in Cursor 

The publish job builds linux/amd64 and linux/arm64, signs the digest
with keyless cosign, and attaches a vulnerability attestation whose
predicate matches the sandbox admission policy.
Object spread already ignores a missing scanner result, and the linter
rejects the empty fallback.
GHCR rejects the mixed-case repository path, so the publish job now
sets IMAGE from ${GITHUB_REPOSITORY,,}. Fulcio keeps Sagax in the
certificate SAN, and Kyverno now accepts only docker.yml on main or
on a tag.
Kyverno now matches the certificate with subjectRegExp, anchored to
docker.yml on main or a v* tag and keeping Sagax. Publish stays on
those same refs.
A branch workflow_dispatch builds, signs, and attests the same way as
publish, but only to ghcr.io/<owner>/sagax-signing-test:pr436, then
verifies that certificate and the vulnerability attestation.
workflow_dispatch stays the way to run the proof. This token cannot
create that event, so a push of this branch starts the same job.
The first proof run built both platforms and stopped at critical=6
high=253, which is what publish does. The proof job keeps those counts
in the attestation and still signs, so the certificate can be checked.
cursoragent and others added 8 commits October 14, 2026 03:23
A branch workflow_dispatch runs the same build, sign, and attest steps
against the test package. Publish stays on main and v* tags. The workflow
comment names the sandbox chart without its directory.
Bring in the term-guard runner fix and the shard 2 test fix.
The proof trigger is a branch dispatch. The test checks that shape
without pinning one ref.
The digest is pushed to a staging package first. The scan, the
signature, and the vulnerability attestation run there. The production
package receives the image only when that copy succeeds.
Keep the staging promotion and take the engine-set image check.
The push credential cannot create workflow_dispatch. A pull request
job asks the Actions token to dispatch this workflow on the head ref.
The branch dispatch is already queued. The pull request job would
request another proof on every later change.
@jencryzthers
jencryzthers marked this pull request as ready for review October 14, 2026 09:07
@jencryzthers
jencryzthers merged commit 3819abb into main Oct 14, 2026
36 of 37 checks passed
jencryzthers added a commit that referenced this pull request Oct 14, 2026
## Quoi

Bump de version, comme #421 pour 0.5.1 :

- `package.json` : `forkVersion` 0.5.2
- `ios/project.yml` : `MARKETING_VERSION` 0.5.2 (même version que le
desktop), `CURRENT_PROJECT_VERSION` 30, sur les quatre cibles
- `docs/releases/0.5.2.md` : notes complètes FR et EN (affichées dans
l'app avant et après la mise à jour), qui complètent celles de #458 avec
tout ce qui est entré depuis 0.5.1 : voix (#427, #435, #422/#424, #450,
#451, #458), démarrage serveur (#433, #460), approbations (#455),
modèles (#462, #466), sandboxes Kubernetes (#463, #465), image Docker
(#436, #444, #456), sécurité (#445), interface (#423, #425, #448, #454,
#461)
- `src/lib/bundled-release-notes.test.ts` : vérifie les nouvelles
entrées

NE PAS fusionner sans le GO de JC : la fusion sur main (changement de
`package.json`) lance `release.yml`.

## Prérequis avant la release

- Créer le secret de dépôt `TRIVYIGNORE_PRIVATE` (#456) : absent ou
vide, `docker.yml` échoue fermé sur le tag.

## Tests locaux (candidat, Node 26.11, macOS)

- `pnpm test:unit` : 8 shards, 1474 fichiers, exit 0
- `pnpm exec vitest run src/lib/bundled-release-notes.test.ts` : exit 0
- `pnpm test:shards` (tous les groupes) lancé avant #466 : exit 1. Les
échecs déterministes sont corrigés par #466 ; restent des e2e qui
passent seuls (charge des 8 shards) et
`server/codex-review.e2e.test.ts`, qui échoue sur ce Mac aussi au tag
`pulsa-v0.5.1` (Node 24 et 26).
- Tests Swift non lancés.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Jean-Christophe Proulx <jencryzthers@Jean-Christophes-Macbook-Pro.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants