feat(ci): migrate signed-deploy gate to siax-templates G17 reference (ADR-W16-003)
masterplan-lock / check (push) Successful in 3s
Security Scan (SIAX Cloud) / security (push) Successful in 16s
CI (SIAX Cloud) / integration (push) Successful in 28s
CI (SIAX Cloud) / quality (push) Successful in 35s
masterplan-lock / check (pull_request) Successful in 5s
CI (SIAX Cloud) / security (pull_request) Successful in 13s
Security Scan (SIAX Cloud) / security (pull_request) Successful in 14s
CI (SIAX Cloud) / integration (pull_request) Successful in 28s
CI (SIAX Cloud) / security (push) Successful in 1m24s
CI (SIAX Cloud) / quality (pull_request) Successful in 1m9s

0pt's own "P007 pattern" release chain (added 2026-09-14) genuinely failed
the ADR-W16-003 promotion bar an audit (2026-09-15) checked it against:
syft/cosign installed via curl + a freshly-refetched checksums file (not a
pinned, out-of-band-verified digest), no vulnerability scan of the built
digest at all, cosign signed only the bare digest (no in-toto/SLSA
statement, no source-SHA/build-identity/environment/SBOM-hash binding, no
scoped key identity), and evidence committed straight back into this same
mutable repo (siax/production-evidence/*.json, siax/source-bundles/*.json
-- nine such commits already existed in this repo's history, deleted in
this change).

Delegates every bar item (1-7: pinned-tool install, SBOM, blocking vuln
scan, in-toto attestation, scoped-key signing, pubkey verification,
AUD0/ST0RE evidence storage) to sax3l/siax-templates' real, reviewed G17
reference implementation (PR #51, merged, pinned at
384e35060b91ea78ec045e14af114abf5d5eb23b), checked out at CI runtime via
the SIAX_CI_TOKEN org secret this repo already had wired for a different
cross-repo write -- picked over a vendored copy (the mechanism st0re/cl0ud/
api0 used) because 0pt has no prior vendoring convention anywhere in this
repo. Matches aud0/h0st's own migrations for the same reason. See
.siax/hooks/README.md for the full composition-mechanism rationale.

.siax/hooks/G17.sh is the adapter: owns only 0pt-specific values (image
repo, key identity, and a license-allowlist policy measured against 0pt's
own real SBOM -- 280 components, one genuine new finding this pass caught
that the old gate never checked at all: gcompat's NCSA license, triaged
and allowed as the real OS-substrate license it is).

cd.yml's own real signed-artifact wait/verify gate (predates this
migration, genuinely 0pt-specific -- polls the registry for release.yml's
artifact, verifies before triggering Coolify) is KEPT, updated from
`cosign verify` (bare digest) to `cosign verify-attestation --type ...`
to match the new attestation format `cosign attest` produces.

A fresh cosign keypair was generated for this migration -- the previously
committed cosign.pub had no corresponding private-key secret ever
provisioned on this repo (the old release.yml's own comment confirms:
"NOT YET SET on sax3l/0pt as of this writing"), so there was no real
existing key material to carry forward.

G20 (live-digest-equality) deliberately NOT wired in this pass: 0pt has no
Coolify application provisioned and no /version endpoint for it to poll
against -- see .siax/hooks/README.md "G20 -- deliberately not wired yet"
for what would need to exist first.

Verified for real during this migration (see PR description for the full
evidence): a real image built from this repo's own Dockerfile, pushed to a
local registry, SBOM'd (syft), scanned (trivy, 0 CRITICAL/HIGH findings),
DSSE-attested (cosign attest) and verified (cosign verify-attestation)
against the new cosign.pub, submitted to a mock AUD0 server enforcing the
real eventInputSchema contract, plus three real tamper-rejection negative
controls (wrong key, wrong predicate type, never-attested digest) against
this exact artifact, plus the reference implementation's own 29/29-assertion
selftest (including a real live check against production api.aud0.siax.io).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
2026-09-15 17:09:38 +02:00
co-authored by Claude Sonnet 5
parent 7555f3d504
commit a3df134caf
42 changed files with 401 additions and 665 deletions
+36 -19
View File
@@ -27,13 +27,31 @@ jobs:
steps:
# -----------------------------------------------------------------
# SIGNED-ARTIFACT GATE (added 2026-09-14, same pattern as
# sax3l/cl0ud + sax3l/st0re's fix/wire-signed-digest-to-deploy): once
# the guard step below stops failing (i.e. once a real Coolify app
# exists for 0pt and COOLIFY_APP_ID is filled in), this job will
# REFUSE to call Coolify at all unless a cosign-verified image exists
# in the registry for the EXACT commit being deployed.
# `.gitea/workflows/release.yml` (added in this same change) is the
# piece that builds, SBOMs, signs, and pushes that image.
# sax3l/cl0ud + sax3l/st0re's fix/wire-signed-digest-to-deploy; this
# job's own wait-for-signed-artifact polling logic below predates and
# is independent of the 2026-09-15 G17 migration, and is KEPT as-is
# here -- it is a real, working, 0pt-specific mechanism, not part of
# what that migration delegates to siax-templates): once the guard
# step below stops failing (i.e. once a real Coolify app exists for
# 0pt and COOLIFY_APP_ID is filled in), this job will REFUSE to call
# Coolify at all unless a verified attestation exists in the registry
# for the EXACT commit being deployed. `.gitea/workflows/release.yml`
# is the piece that builds, SBOMs, scans, attests, and pushes that
# image (rewritten 2026-09-15 to delegate to sax3l/siax-templates'
# G17 reference hook -- see `.siax/hooks/README.md`).
#
# VERIFY STEP CHANGED 2026-09-15 (part of the G17 migration): the old
# release.yml called `cosign sign` on the bare digest, so this job's
# gate used `cosign verify`. The new release.yml calls `cosign attest`
# instead -- a full DSSE-signed in-toto Statement binding digest +
# source SHA + build identity + environment + SBOM hash (ADR-W16-003
# bar items 4/5), not just a bare-digest signature. `cosign verify`
# against a `cosign attest`-only artifact fails with "no matching
# signatures" (attestations and signatures are stored/verified
# separately in cosign's model) -- so this step now calls
# `cosign verify-attestation --type <predicate-type>` instead, the
# same command `.siax/hooks/G17.sh` itself already runs and requires
# to PASS before it will submit evidence to AUD0.
#
# HONEST LIMITATION (identical to cl0ud/st0re/h0st's writeup):
# `siax.config.json`'s `deploy.target: "coolify"` and this file's own
@@ -102,6 +120,7 @@ jobs:
env:
IMAGE_REF: ${{ steps.sha.outputs.image_ref }}
SHORT: ${{ steps.sha.outputs.short }}
PREDICATE_TYPE: https://siax.io/attestations/g17-release-evidence/v1
run: |
set -euo pipefail
test -f cosign.pub || { echo "::error::cosign.pub not found at repo root — cannot verify, refusing to deploy"; exit 1; }
@@ -114,13 +133,11 @@ jobs:
# hanging forever.
#
# The loop retries TWO distinct not-ready states (measured live on
# run 2265dbb 2026-09-15: deploy pulled the image at 02:36:45 and
# failed verify at 02:37:03 with "no signatures found" while the
# release run attached the signature at 02:37:11 — an 8-second race
# that the pull-only retry missed):
# 1. tag not pushed yet (release still building)
# 2. tag pushed but signature not attached yet (release between
# push and cosign sign)
# run 2265dbb 2026-09-15, under the OLD bare-signature gate — the
# same race applies to attestation-attach timing today): tag not
# pushed yet (release still building) vs. tag pushed but the
# attestation not attached yet (release between push and
# `cosign attest`).
attempt=0
max_attempts=40
digest=""
@@ -147,16 +164,16 @@ jobs:
digest="${repo_digest##*@}"
echo "$digest" | grep -Eq '^sha256:[0-9a-f]{64}$' || { echo "::error::unexpected digest shape: $digest"; exit 1; }
echo "verifying cosign signature on ${IMAGE_REPO}@${digest} ..."
if cosign verify --key cosign.pub "${IMAGE_REPO}@${digest}" >/tmp/verify.log 2>&1; then
echo "verifying cosign attestation on ${IMAGE_REPO}@${digest} ..."
if cosign verify-attestation --key cosign.pub --type "$PREDICATE_TYPE" "${IMAGE_REPO}@${digest}" >/tmp/verify.log 2>&1; then
break
fi
if grep -q "no signatures found" /tmp/verify.log; then
echo "image present but signature not attached yet (attempt $attempt/$max_attempts) — waiting for release.yml's cosign sign..."
if grep -qE "no matching (attestations|signatures) found" /tmp/verify.log; then
echo "image present but attestation not attached yet (attempt $attempt/$max_attempts) — waiting for release.yml's cosign attest..."
sleep 15
continue
fi
echo "::error::cosign verify FAILED for ${IMAGE_REPO}@${digest} (not a not-ready state — refusing to deploy)"
echo "::error::cosign verify-attestation FAILED for ${IMAGE_REPO}@${digest} (not a not-ready state — refusing to deploy)"
cat /tmp/verify.log
exit 1
done