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
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:
+36
-19
@@ -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
|
||||
|
||||
+99
-230
@@ -1,75 +1,100 @@
|
||||
name: Release chain (P007 pattern)
|
||||
name: Release chain (G17, ADR-W16-003)
|
||||
|
||||
# ADDED 2026-09-14: 0pt had NO SBOM/sign/digest chain at all before this file
|
||||
# (re-confirmed live: no cosign/syft/sbom hit anywhere under .gitea/workflows/,
|
||||
# only doc mentions in CHANGELOG.md/docs/architecture/ARCHITECTURE.md). This
|
||||
# is the proven sax3l/cl0ud + sax3l/st0re pattern (originally inlined
|
||||
# 2026-09-10 from sax3l/siax-standard's release-chain.yml, then hardened
|
||||
# 2026-09-14), authored directly for 0pt because cross-repo `uses:` clones
|
||||
# anonymously on this Gitea instance and fails with "repository not found"
|
||||
# against private repos (the same documented trap that forced cl0ud/st0re to
|
||||
# inline rather than call out to a shared workflow).
|
||||
# Builds + pushes the 0pt image, then hands off to the shared
|
||||
# sax3l/siax-templates G17 reference hook for every ADR-W16-003 bar item
|
||||
# 1-7 (pinned-tool install, SBOM, blocking vuln scan, in-toto attestation,
|
||||
# scoped-key signing, pubkey verification, AUD0/ST0RE evidence storage).
|
||||
#
|
||||
# Cosign keypair is 0pt-specific (generated offline 2026-09-14, never
|
||||
# transmitted anywhere); cosign.pub in the repo root is the corresponding
|
||||
# public key. Neither this Dockerfile nor h0st's declares
|
||||
# `ARG GIT_SHA`/`ARG BUILD_TIME`, so this file does not pass them as
|
||||
# --build-arg (would just produce a harmless-but-noisy "not consumed"
|
||||
# warning) -- GIT_SHA/DIGEST still go into the evidence JSON below either way.
|
||||
# REPLACES this repo's own ad hoc "P007 pattern" release chain (added
|
||||
# 2026-09-14). An audit (2026-09-15) found that chain failed most of the
|
||||
# real promotion bar it claimed to meet: syft/cosign installed via a `curl`
|
||||
# + freshly-refetched checksums file (not a pinned, out-of-band-verified
|
||||
# digest -- see siax-templates' `lib/pinned-tools.sh` header for exactly
|
||||
# why that is not a verified digest), NO vulnerability scan of the built
|
||||
# digest at all, `cosign sign` on the bare digest only (no in-toto/SLSA
|
||||
# statement, no source-SHA/build-identity/environment/SBOM-hash bound
|
||||
# together, 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 before this change; deleted in this same PR, superseded by
|
||||
# the real AUD0 write below). This file keeps ONLY what is genuinely
|
||||
# 0pt-specific (image name, tag scheme, registry push, Dockerfile) and
|
||||
# delegates everything else to `.siax/hooks/G17.sh` -> the shared reference
|
||||
# implementation. See `.siax/hooks/README.md` for the pin status and
|
||||
# required secrets (none of which were provisioned for the old gate either
|
||||
# -- see that file's own note).
|
||||
#
|
||||
# STATUS NOTE (see .gitea/workflows/cd.yml's own header): 0pt has NO Coolify
|
||||
# Application provisioned yet -- cd.yml's guard step already fails closed on
|
||||
# the placeholder COOLIFY_APP_ID for that reason, independent of this file.
|
||||
# This release chain is deliberately built ahead of that: once the app
|
||||
# exists and cd.yml's placeholder is replaced with a real UUID, the signed-
|
||||
# artifact gate added to cd.yml in this same change is already wired and
|
||||
# ready, instead of being a second follow-up piece of work.
|
||||
#
|
||||
# Krävda repo-secrets (NOT YET SET on sax3l/0pt as of this writing -- this
|
||||
# file will fail closed on its first run until Simon sets them, same
|
||||
# prerequisite cl0ud/st0re needed before their release.yml went green
|
||||
# 2026-09-10): REGISTRY_USER/REGISTRY_TOKEN (git.cloud.siax.io push),
|
||||
# COSIGN_PRIVATE_KEY/COSIGN_PASSWORD (the private half of this repo's
|
||||
# cosign.pub), SIAX_CI_TOKEN (scoped write:repository token for the
|
||||
# evidence-commit push -- the runner's ephemeral actions token gets a
|
||||
# pre-receive 500, GetUserByID(uid=-2), same fleet-wide gotcha as cl0ud/st0re).
|
||||
# Verification: cosign verify --key cosign.pub git.cloud.siax.io/sax3l/0pt@<digest>
|
||||
# DELIBERATELY ONE JOB. Gitea 1.26 on this fleet resolves org-level
|
||||
# secrets (SIAX_CI_TOKEN below is org-level) only for the FIRST job of a
|
||||
# workflow file -- learned the hard way on sax3l/h0st's and sax3l/aud0's
|
||||
# own G17 migrations. 0pt does not wire a G20 post-deploy step in this
|
||||
# pass at all (see `.siax/hooks/README.md` "G20 -- deliberately not wired
|
||||
# yet": no Coolify application provisioned for 0pt, no `/version`
|
||||
# endpoint), so the single-job constraint that forces G20 into its own
|
||||
# workflow file elsewhere does not yet bite here -- documented anyway so a
|
||||
# future PR adding G20 does not repeat the mistake.
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
IMAGE_REPO: git.cloud.siax.io/sax3l/0pt
|
||||
DOCKERFILE: Dockerfile
|
||||
SIAX_TEMPLATES_REPO: sax3l/siax-templates
|
||||
# PIN STATUS 2026-09-15: sax3l/siax-templates PR #51
|
||||
# (feat/g17-signed-deploy-gate-adr-w16-003) MERGED to main, plus three
|
||||
# real follow-up fixes on top -- #56/#57 (SPDX compound-license-
|
||||
# expression evaluation, exercised live by this repo's own
|
||||
# G17_LICENSE_ALLOW policy in .siax/hooks/G17.sh) and #59 (G20 retry
|
||||
# logic -- not used by 0pt yet, but the pin picks up main's current tip
|
||||
# rather than an older commit, matching what a fresh migration reviews).
|
||||
SIAX_TEMPLATES_REF: main
|
||||
SIAX_TEMPLATES_PINNED_SHA: 384e35060b91ea78ec045e14af114abf5d5eb23b
|
||||
SIAX_TEMPLATES_DIR: /tmp/siax-templates-g17-ref
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Build, push, SBOM, sign, record evidence
|
||||
name: Build, push, G17 (SBOM/scan/attest/verify/evidence)
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
env:
|
||||
IMAGE_REPO: git.cloud.siax.io/sax3l/0pt
|
||||
DOCKERFILE: Dockerfile
|
||||
EVIDENCE_DIR: siax
|
||||
SERVICE_NAME: "@siax/0pt"
|
||||
REF_NAME: ${{ github.ref_name }}
|
||||
RUN_ID: ${{ github.run_id }}
|
||||
RUN_ATTEMPT: ${{ github.run_attempt }}
|
||||
steps:
|
||||
- uses: https://git.siax.io/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4, mirrored + SHA-pinned (SUP-06, same pin n0d/cl0ud/st0re already use)
|
||||
- uses: https://git.siax.io/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4, mirrored + SHA-pinned (SUP-06, same pin n0d/cl0ud/st0re/h0st already use)
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# --- fetch the shared G17 reference implementation -----------------
|
||||
# Same authenticated-clone-at-runtime mechanism this repo's OLD
|
||||
# release.yml already used SIAX_CI_TOKEN for (the evidence-commit
|
||||
# push this PR deletes) -- see .siax/hooks/G17.sh's header for why
|
||||
# NOT a `uses:` reusable workflow / submodule / vendored copy. Fails
|
||||
# closed if the branch has moved past the exact commit this adapter
|
||||
# was reviewed against.
|
||||
- name: Fetch siax-templates G17 reference (pinned)
|
||||
env:
|
||||
SIAX_CI_TOKEN: ${{ secrets.SIAX_CI_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
rm -rf "$SIAX_TEMPLATES_DIR"
|
||||
git clone --quiet --branch "$SIAX_TEMPLATES_REF" \
|
||||
"https://oauth2:${SIAX_CI_TOKEN}@git.siax.io/${SIAX_TEMPLATES_REPO}.git" "$SIAX_TEMPLATES_DIR"
|
||||
actual_sha="$(git -C "$SIAX_TEMPLATES_DIR" rev-parse HEAD)"
|
||||
if [ "$actual_sha" != "$SIAX_TEMPLATES_PINNED_SHA" ]; then
|
||||
echo "::error::siax-templates $SIAX_TEMPLATES_REF moved (now $actual_sha, pinned $SIAX_TEMPLATES_PINNED_SHA) -- refusing to run an unreviewed version of the gate. Re-review and update SIAX_TEMPLATES_PINNED_SHA deliberately."
|
||||
exit 1
|
||||
fi
|
||||
chmod +x "$SIAX_TEMPLATES_DIR/ci/v2/reference-hooks/"*.sh "$SIAX_TEMPLATES_DIR/ci/v2/reference-hooks/lib/"*.sh
|
||||
echo "siax-templates G17 reference @ $actual_sha (pinned, verified)"
|
||||
|
||||
- name: Resolve SHA + tag (never :latest)
|
||||
id: sha
|
||||
run: |
|
||||
set -euo pipefail
|
||||
full="$(git rev-parse HEAD)"
|
||||
short="$(git rev-parse --short=12 HEAD)"
|
||||
built_at="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||
echo "full=$full" >> "$GITHUB_OUTPUT"
|
||||
echo "short=$short" >> "$GITHUB_OUTPUT"
|
||||
echo "built_at=$built_at" >> "$GITHUB_OUTPUT"
|
||||
echo "image_ref=${IMAGE_REPO}:sha-$short" >> "$GITHUB_OUTPUT"
|
||||
echo "image_tag=sha-$short" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Docker login (git.cloud.siax.io)
|
||||
env:
|
||||
@@ -82,194 +107,38 @@ jobs:
|
||||
|
||||
- name: Build
|
||||
env:
|
||||
IMAGE_REF: ${{ steps.sha.outputs.image_ref }}
|
||||
IMAGE_TAG: ${{ steps.sha.outputs.image_tag }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
docker build \
|
||||
-f "$DOCKERFILE" \
|
||||
-t "$IMAGE_REF" \
|
||||
.
|
||||
docker build -f "$DOCKERFILE" -t "${IMAGE_REPO}:${IMAGE_TAG}" .
|
||||
|
||||
- name: Push (tag sha-<12>, never :latest)
|
||||
- name: Push (immutable sha-<12> tag, never :latest)
|
||||
env:
|
||||
IMAGE_REF: ${{ steps.sha.outputs.image_ref }}
|
||||
run: docker push "$IMAGE_REF"
|
||||
IMAGE_TAG: ${{ steps.sha.outputs.image_tag }}
|
||||
run: docker push "${IMAGE_REPO}:${IMAGE_TAG}"
|
||||
|
||||
- name: Read back the digest the registry actually stored (never assumed)
|
||||
id: digest
|
||||
# --- G17: everything else, delegated -------------------------------
|
||||
- name: G17 (bar items 1-7, delegated to siax-templates)
|
||||
env:
|
||||
IMAGE_REF: ${{ steps.sha.outputs.image_ref }}
|
||||
ARTIFACT_COMMIT_SHA: ${{ steps.sha.outputs.full }}
|
||||
ARTIFACT_IMAGE_TAG: ${{ steps.sha.outputs.image_tag }}
|
||||
CI_RUN_ID: ${{ github.run_id }}
|
||||
CI_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
G17_COSIGN_KEY: /tmp/0pt-g17-cosign.key
|
||||
G17_COSIGN_KEY_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
|
||||
AUD0_INGEST_TOKEN: ${{ secrets.AUD0_INGEST_TOKEN }}
|
||||
AUD0_TENANT_ID: ${{ secrets.AUD0_TENANT_ID }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
# `docker inspect`'s RepoDigests can carry MULTIPLE entries (e.g. one for
|
||||
# whatever this image was originally pulled/built FROM, plus one per registry
|
||||
# it has since been pushed to) — index 0 is not reliably "the one we just
|
||||
# pushed". Filter for the entry whose repo matches IMAGE_REPO instead (same
|
||||
# filter proven live on cl0ud's P007 build-sandbox: a probe push showed
|
||||
# RepoDigests holding both an "alpine@sha256:..." entry AND the
|
||||
# "git.cloud.siax.io/...@sha256:..." entry side by side).
|
||||
repo_digest="$(docker inspect --format='{{json .RepoDigests}}' "$IMAGE_REF" \
|
||||
| node -e "const rd=JSON.parse(require('fs').readFileSync(0,'utf8')); const prefix=process.env.IMAGE_REPO+'@'; const match=rd.find(r=>r.startsWith(prefix)); if(!match){console.error('no RepoDigests entry starting with '+prefix+' among: '+JSON.stringify(rd));process.exit(1);} console.log(match);")"
|
||||
digest="${repo_digest##*@}"
|
||||
echo "$digest" | grep -Eq '^sha256:[0-9a-f]{64}$' || { echo "::error::unexpected digest shape: $digest"; exit 1; }
|
||||
echo "digest=$digest" >> "$GITHUB_OUTPUT"
|
||||
echo "pushed and verified: $IMAGE_REF @ $digest"
|
||||
echo "${{ secrets.COSIGN_PRIVATE_KEY }}" > "$G17_COSIGN_KEY"
|
||||
trap 'rm -f "$G17_COSIGN_KEY"' EXIT
|
||||
bash .siax/hooks/G17.sh
|
||||
|
||||
# KNOWN RISK, NOT YET FIXED (same open issue as cl0ud's/st0re's/h0st's
|
||||
# copy of this file, flagged 2026-09-03/09-14): this fleet's runner
|
||||
# egress is confirmed to reach raw.githubusercontent.com but NOT
|
||||
# github.com/*/releases/download URLs (curl -sfL -> silent failure).
|
||||
# The two `curl -fsSL -O https://github.com/.../releases/download/...`
|
||||
# steps below (syft, cosign) use exactly that broken URL shape, and
|
||||
# neither tool ships a raw.githubusercontent.com-hosted installer that
|
||||
# avoids a github.com/releases fetch for the actual binary. Left as
|
||||
# pinned, checksum-verified curl installs, same as cl0ud/st0re/h0st;
|
||||
# the first real run of this file on 0pt's own runners is the first
|
||||
# live evidence for OR against this risk actually manifesting here
|
||||
# (not simulated in this dry-run pass — see PR description).
|
||||
- name: Install syft v1.51.1 (pinned, checksum-verified — never :latest)
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cd /tmp
|
||||
curl -fsSL -O https://github.com/anchore/syft/releases/download/v1.51.1/syft_1.51.1_linux_amd64.tar.gz
|
||||
curl -fsSL -O https://github.com/anchore/syft/releases/download/v1.51.1/syft_1.51.1_checksums.txt
|
||||
grep 'syft_1.51.1_linux_amd64.tar.gz' syft_1.51.1_checksums.txt | sha256sum -c -
|
||||
tar -xzf syft_1.51.1_linux_amd64.tar.gz syft
|
||||
install -m 0755 syft /usr/local/bin/syft
|
||||
syft version
|
||||
|
||||
- name: Install cosign v3.1.3 (pinned, checksum-verified — never :latest)
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cd /tmp
|
||||
curl -fsSL -O https://github.com/sigstore/cosign/releases/download/v3.1.3/cosign-linux-amd64
|
||||
curl -fsSL -O https://github.com/sigstore/cosign/releases/download/v3.1.3/cosign_checksums.txt
|
||||
grep 'cosign-linux-amd64$' cosign_checksums.txt | sha256sum -c -
|
||||
install -m 0755 cosign-linux-amd64 /usr/local/bin/cosign
|
||||
cosign version
|
||||
|
||||
- name: SBOM (syft, spdx-json, against the DIGEST not the tag)
|
||||
env:
|
||||
DIGEST: ${{ steps.digest.outputs.digest }}
|
||||
SHORT: ${{ steps.sha.outputs.short }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p "$EVIDENCE_DIR/_release-artifacts"
|
||||
syft "${IMAGE_REPO}@${DIGEST}" -o "spdx-json=${EVIDENCE_DIR}/_release-artifacts/sbom-${SHORT}.spdx.json"
|
||||
|
||||
- name: Sign (cosign, key-based — see cosign.pub at repo root)
|
||||
env:
|
||||
COSIGN_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }}
|
||||
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
|
||||
DIGEST: ${{ steps.digest.outputs.digest }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
echo "$COSIGN_KEY" > /tmp/cosign.key
|
||||
cosign sign --yes --key /tmp/cosign.key "${IMAGE_REPO}@${DIGEST}"
|
||||
rm -f /tmp/cosign.key
|
||||
|
||||
- name: Verify the signature just written (fail closed if it does not verify)
|
||||
env:
|
||||
DIGEST: ${{ steps.digest.outputs.digest }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test -f cosign.pub || { echo "::error::cosign.pub not found at repo root — commit the PUBLIC key (not a secret) so anyone can verify without CI access"; exit 1; }
|
||||
cosign verify --key cosign.pub "${IMAGE_REPO}@${DIGEST}"
|
||||
|
||||
- name: Write siax.source-bundle + siax.production-evidence records
|
||||
env:
|
||||
SHA_FULL: ${{ steps.sha.outputs.full }}
|
||||
SHA_SHORT: ${{ steps.sha.outputs.short }}
|
||||
DIGEST: ${{ steps.digest.outputs.digest }}
|
||||
IMAGE_REF: ${{ steps.sha.outputs.image_ref }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p "$EVIDENCE_DIR/source-bundles" "$EVIDENCE_DIR/production-evidence"
|
||||
now="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||
repo_name="$(basename "$(git rev-parse --show-toplevel)")"
|
||||
|
||||
cat > "$EVIDENCE_DIR/source-bundles/release-${SHA_SHORT}.json" <<JSON
|
||||
{
|
||||
"id": "sb-release-${SHA_SHORT}",
|
||||
"repo": "$repo_name",
|
||||
"commitSha": "$SHA_FULL",
|
||||
"branch": "$REF_NAME",
|
||||
"buildId": "${RUN_ID}-${RUN_ATTEMPT}",
|
||||
"artifactId": "$IMAGE_REF",
|
||||
"producedAt": "$now"
|
||||
}
|
||||
JSON
|
||||
|
||||
cat > "$EVIDENCE_DIR/production-evidence/release-${SHA_SHORT}-artifact.json" <<JSON
|
||||
{
|
||||
"id": "pe-artifact-${SHA_SHORT}",
|
||||
"repo": "$repo_name",
|
||||
"evidenceType": "artifact-digest",
|
||||
"verifiedAt": "$now",
|
||||
"verifiedBy": "gitea-ci",
|
||||
"result": "pass",
|
||||
"proofRef": "pushed $IMAGE_REF to $IMAGE_REPO",
|
||||
"tool": "docker",
|
||||
"sourceSha": "$SHA_FULL",
|
||||
"digest": "$DIGEST"
|
||||
}
|
||||
JSON
|
||||
|
||||
cat > "$EVIDENCE_DIR/production-evidence/release-${SHA_SHORT}-sbom.json" <<JSON
|
||||
{
|
||||
"id": "pe-sbom-${SHA_SHORT}",
|
||||
"repo": "$repo_name",
|
||||
"evidenceType": "sbom",
|
||||
"verifiedAt": "$now",
|
||||
"verifiedBy": "gitea-ci",
|
||||
"result": "pass",
|
||||
"proofRef": "$EVIDENCE_DIR/_release-artifacts/sbom-${SHA_SHORT}.spdx.json",
|
||||
"tool": "syft",
|
||||
"sbomFormat": "spdx-json",
|
||||
"digest": "$DIGEST"
|
||||
}
|
||||
JSON
|
||||
|
||||
cat > "$EVIDENCE_DIR/production-evidence/release-${SHA_SHORT}-signature.json" <<JSON
|
||||
{
|
||||
"id": "pe-signature-${SHA_SHORT}",
|
||||
"repo": "$repo_name",
|
||||
"evidenceType": "signature",
|
||||
"verifiedAt": "$now",
|
||||
"verifiedBy": "gitea-ci",
|
||||
"result": "pass",
|
||||
"proofRef": "cosign verify --key cosign.pub ${IMAGE_REPO}@${DIGEST} (verified in this same run)",
|
||||
"tool": "cosign",
|
||||
"signatureTool": "cosign",
|
||||
"keyless": false,
|
||||
"digest": "$DIGEST"
|
||||
}
|
||||
JSON
|
||||
|
||||
# upload-artifact deliberately OMITTED: act_runner on this fleet has no
|
||||
# GHES-artifact-API, so upload-artifact@v4 always dies even with
|
||||
# continue-on-error: true and can abort the whole job before the
|
||||
# evidence-commit step below runs (proven on cl0ud run 23340, fixed
|
||||
# there 2026-09-14 by deleting the step outright — applied here from
|
||||
# the start instead of repeating the same bug). Evidence lands in the
|
||||
# repo via the commit step below regardless.
|
||||
- name: Commit evidence back to the calling repo
|
||||
if: true
|
||||
env:
|
||||
SHA_SHORT: ${{ steps.sha.outputs.short }}
|
||||
SIAX_CI_TOKEN: ${{ secrets.SIAX_CI_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git config user.name "siax-ci"
|
||||
git config user.email "[email protected]"
|
||||
git add "$EVIDENCE_DIR/source-bundles" "$EVIDENCE_DIR/production-evidence"
|
||||
if git diff --cached --quiet; then
|
||||
echo "no evidence changes to commit"
|
||||
else
|
||||
git commit -m "chore(release-chain): evidence for sha-${SHA_SHORT} [skip ci]"
|
||||
# Runnerns ephemeral actions-token (uid -2) kan inte pusha:
|
||||
# pre-receive GetUserByID(-2) → 500. Autentisera som riktig
|
||||
# Gitea-user via SIAX_CI_TOKEN (samma mönster som cl0ud/st0re/h0st).
|
||||
git config http.https://git.siax.io/.extraheader "AUTHORIZATION: basic $(printf 'x-access-token:%s' "${SIAX_CI_TOKEN}" | base64 -w0)"
|
||||
git push origin "HEAD:${REF_NAME}"
|
||||
fi
|
||||
# NOTE: deliberately NO `actions/upload-artifact@v4` step here.
|
||||
# sax3l/cl0ud's release.yml (run 23340, 2026-09-14) documents that
|
||||
# this Gitea instance's act_runner does not reliably support
|
||||
# upload-artifact@v4 even with continue-on-error: true, and that it
|
||||
# can abort the whole job before later steps run. G17.sh's own AUD0
|
||||
# submission (bar item 7, step above) is already the durable evidence
|
||||
# record; a convenience local copy is not worth re-triggering that
|
||||
# known breakage.
|
||||
|
||||
Reference in New Issue
Block a user