Files
Bradford Matthews 10c911d54a Fixed subject RDNs for ACME under name-constrained CAs
Snapshot of development commit 2e7694a6. Templates can fix subject RDNs
(DC, O, OU, L, ST, C) appended after the CN, ACME issues under its bound
template's whole policy, and the engine checks the leaf against the
issuing CA's name constraints before signing. How-to:
docs/ops/ACME_NAME_CONSTRAINTS.md.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-31 15:41:33 -04:00

527 lines
22 KiB
YAML

# PUBLIC PIPELINE SOURCE (W37). This file is the canonical
# .github/workflows/release.yml of the public repository bpmforge/kryptkeeper;
# the publish snapshot copies it into place. The dev repository's own
# .github/workflows/release.yml is the internal pipeline (D-210) and must not be
# replaced by this file.
#
# W20-02: single goreleaser-driven release pipeline, triggered by a `v*` tag.
# Produces binaries (linux/amd64, linux/arm64, darwin/arm64) for all four
# commands plus the Windows agent (zip + MSI) and a Homebrew formula
# asset, checksums, CycloneDX SBOMs, nfpm deb/rpm, and multi-arch images
# for all four Dockerfiles pushed to ghcr.io/bpmforge/*, plus a GitHub
# Release with notes from docs/release/RELEASE_NOTES_<tag>.md (fails if
# absent). Everything is signed keyless (Sigstore) via
# cosign's GitHub Actions OIDC identity -- there is no long-lived signing key
# to rotate or leak.
#
# Secrets this workflow needs: NONE beyond the automatic GITHUB_TOKEN.
# `permissions: id-token: write` is what lets cosign mint a short-lived
# Sigstore certificate from the job's own OIDC token; `packages: write` logs
# in to ghcr.io with the same GITHUB_TOKEN (no PAT, no COSIGN_KEY/PASSWORD --
# see packaging/SIGNING.md's D-101 history of the keyed approach this
# replaces for the release path).
name: Release
on:
push:
tags:
- 'v*'
# Read-only by default (IAC-016); only the goreleaser job elevates.
permissions:
contents: read
jobs:
# The Go suite in seven parallel jobs (six internal/bootstrap shards and the
# rest), as in ci-main: one runner took 15 of a 31-minute release. Every
# shard 1..6 must be listed; goreleaser needs all of them.
test:
name: Tests (${{ matrix.part }})
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
part: ["--shard 1/6", "--shard 2/6", "--shard 3/6", "--shard 4/6", "--shard 5/6", "--shard 6/6", "--rest"]
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version-file: go.mod
# false: the runner mounts persistent kk-gomod and kk-gobuild volumes there;
# setup-go's cache re-downloaded ~2.7 GB over them on every job.
cache: false
# Same flags as the old single job (no -race; ci-main covers that).
- env:
GO_TEST_FLAGS: -timeout 30m
run: bash scripts/test/go-unit-sharded.sh ${{ matrix.part }}
# W32-03: a tag whose docs/openapi.yaml info.version differs from the tag
# must not release. Release prep bumps info.version at every tag, so this
# goes red by design when that step is forgotten.
spec-version:
name: Spec version matches tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Spec info.version equals the tag
env:
RELEASE_TAG: ${{ github.ref_name }}
run: bash scripts/check-spec-version.sh "$RELEASE_TAG"
- name: Version-check fixtures
run: bash tests/smoke/sdk/test-check-spec-version.sh
# W32-03: generated Go/TS/Python SDKs issue, list (>= 2 pages) and revoke
# against a hub built from this commit. goreleaser needs this job, so a red
# smoke blocks the release (a job ordered after goreleaser would not).
sdk-smoke:
name: SDK contract smoke
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version-file: go.mod
cache: true
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version-file: ui/.nvmrc
- name: Generate and compile SDKs
env:
RELEASE_TAG: ${{ github.ref_name }}
run: |
bash scripts/quote-openapi-descriptions.sh docs/openapi.yaml
bash scripts/gen-sdks.sh --version "${RELEASE_TAG#v}" --check
- name: Smoke the SDKs against a live hub
run: bash tests/smoke/sdk/run.sh
goreleaser:
name: goreleaser release
runs-on: ubuntu-latest
needs: [test, spec-version, sdk-smoke]
permissions:
contents: write
packages: write
id-token: write
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
fetch-depth: 0
# goreleaser-action does not run args through a shell, so $RELEASE_TAG
# would not expand there. Validate the tag, then hand the path over via
# GITHUB_ENV (read below as the env context).
- name: Require release notes for this tag
env:
RELEASE_TAG: ${{ github.ref_name }}
run: |
if ! [[ "$RELEASE_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$ ]]; then
echo "::error::tag '$RELEASE_TAG' is not a vMAJOR.MINOR.PATCH[-prerelease] version"
exit 1
fi
notes="docs/release/RELEASE_NOTES_${RELEASE_TAG}.md"
if [ ! -s "$notes" ]; then
echo "::error::missing release notes: create $notes before tagging $RELEASE_TAG"
exit 1
fi
echo "RELEASE_NOTES_FILE=$notes" >> "$GITHUB_ENV"
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version-file: go.mod
# false: the runner mounts persistent kk-gomod and kk-gobuild volumes there;
# setup-go's cache re-downloaded ~2.7 GB over them on every job.
cache: false
- name: Set up QEMU (cross-arch docker builds)
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Log in to GHCR
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install Syft (SBOM)
uses: anchore/sbom-action/download-syft@66cbf4bc1f1c0d2edc94016e65bc221b6bb0ad6c # v0.24.3
- name: Install Cosign (keyless)
uses: sigstore/cosign-installer@7e8b541eb2e61bf99390e1afd4be13a184e9ebc5 # v3.10.1
# wixl builds the Windows agent MSI from a goreleaser post-build hook
# (.goreleaser.yaml, build kryptkeeper-agent-windows); the MSI then lands
# in checksums.txt via checksum.extra_files and is signed with it.
# Ubuntu 24.04 ships wixl as its own package, separate from msitools.
- name: Install msitools + wixl (Windows agent MSI)
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends msitools wixl
wixl --version
- uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
with:
distribution: goreleaser
version: 'v2.18.3'
args: release --clean --release-notes=${{ env.RELEASE_NOTES_FILE }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Pin the version to the pushed tag: with an rc and a final tag on the
# same commit, goreleaser would otherwise pick either one.
GORELEASER_CURRENT_TAG: ${{ github.ref_name }}
# W23-32: FIPS 140-3 image variant (Dockerfile.fips, GOFIPS140 build). Kept
# out of goreleaser and out of default CI: it compiles from source for both
# architectures. Tagged <version>-fips and signed keyless like the others.
fips-image:
name: FIPS image
runs-on: ubuntu-latest
needs: goreleaser
permissions:
contents: read
packages: write
id-token: write
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Set up QEMU (cross-arch docker builds)
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Log in to GHCR
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install Cosign (keyless)
uses: sigstore/cosign-installer@7e8b541eb2e61bf99390e1afd4be13a184e9ebc5 # v3.10.1
- name: Build and push FIPS image
env:
RELEASE_TAG: ${{ github.ref_name }}
COMMIT_SHA: ${{ github.sha }}
run: |
set -euo pipefail
docker buildx build --platform linux/amd64,linux/arm64 \
-f Dockerfile.fips --build-arg GOFIPS140=v1.0.0 \
--build-arg VERSION="$RELEASE_TAG" --build-arg COMMIT="$COMMIT_SHA" \
-t "ghcr.io/bpmforge/kryptkeeper:${RELEASE_TAG#v}-fips" \
--push --iidfile digest.txt .
cosign sign --yes "ghcr.io/bpmforge/kryptkeeper@$(cat digest.txt)"
# Homebrew formula as a release asset (there is no tap repo). Rendered from
# the signed checksums.txt, so the formula's sha256 is the signed value of
# the darwin/arm64 tarball. goreleaser's own `brews` pipe runs after the
# checksum step and is deprecated, so it cannot put the formula in
# checksums.txt; the formula is signed on its own (keyless cosign, same
# identity) instead.
homebrew-formula:
name: Homebrew formula asset
runs-on: ubuntu-latest
needs: goreleaser
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Install Cosign (keyless)
uses: sigstore/cosign-installer@7e8b541eb2e61bf99390e1afd4be13a184e9ebc5 # v3.10.1
- name: Render, sign and upload kryptkeeper.rb
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ github.ref_name }}
REPO: ${{ github.repository }}
run: |
set -euo pipefail
work="$RUNNER_TEMP/formula"
mkdir -p "$work"
gh release download "$RELEASE_TAG" --repo "$REPO" --dir "$work" \
--pattern checksums.txt --pattern checksums.txt.sig --pattern checksums.txt.pem
# Trust only a checksums.txt signed by this repo's release workflow.
cosign verify-blob \
--certificate "$work/checksums.txt.pem" \
--signature "$work/checksums.txt.sig" \
--certificate-identity "https://github.com/${REPO}/.github/workflows/release.yml@refs/tags/${RELEASE_TAG}" \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
"$work/checksums.txt"
bash packaging/homebrew/render-formula.sh "$work/checksums.txt" "$RELEASE_TAG" > "$work/kryptkeeper.rb"
cosign sign-blob --yes \
--output-signature "$work/kryptkeeper.rb.sig" \
--output-certificate "$work/kryptkeeper.rb.pem" \
"$work/kryptkeeper.rb"
gh release upload "$RELEASE_TAG" --repo "$REPO" --clobber \
"$work/kryptkeeper.rb" "$work/kryptkeeper.rb.sig" "$work/kryptkeeper.rb.pem"
# W33-09: verify every signature right after publish, against the identity
# of THIS workflow at THIS tag. A mismatch fails the run, which skips
# promote-latest, so `latest` keeps pointing at the previous release.
# W37-01 (D-309): the Helm chart as an OCI artifact in ghcr, signed keyless
# with this workflow's identity like the images. scripts/release/helm-oci.sh
# packages at the tag version, pushes, signs and verifies a clean pull.
helm-chart:
name: Helm chart (OCI)
runs-on: ubuntu-latest
needs: goreleaser
permissions:
contents: read
packages: write
id-token: write
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
# Helm is preinstalled on GitHub's ubuntu-latest image.
- name: Helm version
run: helm version --short
- name: Install Cosign (keyless)
uses: sigstore/cosign-installer@7e8b541eb2e61bf99390e1afd4be13a184e9ebc5 # v3.10.1
- name: Log in to GHCR for Helm
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: echo "$GH_TOKEN" | helm registry login ghcr.io --username "${{ github.actor }}" --password-stdin
# cosign reads the Docker credential store, not Helm's registry config, so
# without this login it cannot push the chart signature (v1.1.0 failed here).
- name: Log in to GHCR for cosign
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Package, push, sign and verify the chart
env:
TAG: ${{ github.ref_name }}
IDENTITY_REGEXP: '^https://github\.com/bpmforge/kryptkeeper/\.github/workflows/release\.yml@refs/tags/v'
run: bash scripts/release/helm-oci.sh "$TAG"
# W38-11 (D-328): first-party plugins as a signed catalogue. Plugins are signed
# with the plugin-signing key the hub embeds (plugin_signing_keys.txt), NOT the
# keyless release identity: the hub verifies plugin signatures offline against
# that key, so using it adds no trust root (packaging/SIGNING.md). This is the
# first CI use of that key; it needs two repository secrets, set by the release
# owner, and the job fails with a plain message while they are absent:
# PLUGIN_SIGNING_KEY contents of kk-plugin.key (cosign-encrypted)
# PLUGIN_SIGNING_PASSWORD its password
# Output: one release asset, plugin-catalogue-<tag>.tar.gz, whose tree is also
# what is copied to site/plugins/ (kryptkeeper.io/plugins/catalogue.json). The
# site deploy stays the owner's manual step (docs/ops/PLUGIN_CATALOGUE.md).
plugin-catalogue:
name: Plugin catalogue
runs-on: ubuntu-latest
needs: goreleaser
permissions:
contents: write
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
ref: ${{ github.ref }}
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version-file: go.mod
cache: false
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version-file: ui/.nvmrc
- name: Install Cosign
uses: sigstore/cosign-installer@7e8b541eb2e61bf99390e1afd4be13a184e9ebc5 # v3.10.1
- name: Build, sign and verify the plugins and the catalogue
env:
PLUGIN_SIGNING_KEY: ${{ secrets.PLUGIN_SIGNING_KEY }}
COSIGN_PASSWORD: ${{ secrets.PLUGIN_SIGNING_PASSWORD }}
run: |
set -euo pipefail
if [ -z "$PLUGIN_SIGNING_KEY" ] || [ -z "$COSIGN_PASSWORD" ]; then
echo "::error::PLUGIN_SIGNING_KEY and PLUGIN_SIGNING_PASSWORD are not set; the plugin catalogue cannot be signed (packaging/SIGNING.md)"
exit 1
fi
umask 077
key="$RUNNER_TEMP/kk-plugin.key"
printf '%s' "$PLUGIN_SIGNING_KEY" > "$key"
trap 'rm -f "$key"' EXIT
# sign-plugins.sh builds (make plugins), signs each manifest and
# verifies every bundle against the key compiled into the hub.
KK_PLUGIN_KEY="$key" bash scripts/sign-plugins.sh
out="$RUNNER_TEMP/plugin-catalogue"
node scripts/plugins/build-catalogue.mjs --dist dist/plugins --plugins plugins \
--out "$out" --base-url https://kryptkeeper.io/plugins
pub="$RUNNER_TEMP/kk-plugin.pub"
sed -n '/-----BEGIN PUBLIC KEY-----/,/-----END PUBLIC KEY-----/p' internal/bootstrap/plugin_signing_keys.txt > "$pub"
cosign sign-blob --yes --key "$key" --bundle "$out/catalogue.json.bundle" \
--signing-config scripts/cosign-signing-config.json "$out/catalogue.json"
cosign verify-blob --key "$pub" --bundle "$out/catalogue.json.bundle" --insecure-ignore-tlog=true "$out/catalogue.json"
tar -C "$out" -czf "$RUNNER_TEMP/plugin-catalogue-${GITHUB_REF_NAME}.tar.gz" .
echo "CATALOGUE_ASSET=$RUNNER_TEMP/plugin-catalogue-${GITHUB_REF_NAME}.tar.gz" >> "$GITHUB_ENV"
- name: Upload the catalogue to the release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ github.ref_name }}
REPO: ${{ github.repository }}
run: gh release upload "$RELEASE_TAG" --repo "$REPO" --clobber "$CATALOGUE_ASSET"
release-verify:
name: Verify signatures
runs-on: ubuntu-latest
needs: [goreleaser, fips-image, homebrew-formula, helm-chart]
permissions:
contents: read
packages: read
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version-file: go.mod
cache: true
- name: Install Cosign (keyless)
uses: sigstore/cosign-installer@7e8b541eb2e61bf99390e1afd4be13a184e9ebc5 # v3.10.1
- name: Log in to GHCR
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Verify release assets and images
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
REPO: ${{ github.repository }}
run: |
set -euo pipefail
identity="https://github.com/${REPO}/.github/workflows/release.yml@refs/tags/${TAG}"
issuer="https://token.actions.githubusercontent.com"
rel="$RUNNER_TEMP/rel"
mkdir -p "$rel"
gh release download "$TAG" --repo "$REPO" --dir "$rel"
cosign verify-blob \
--certificate "$rel/checksums.txt.pem" \
--signature "$rel/checksums.txt.sig" \
--certificate-identity "$identity" \
--certificate-oidc-issuer "$issuer" \
"$rel/checksums.txt"
# The archives (and MSI, install.sh) must match the signed list.
(cd "$rel" && sha256sum --check --ignore-missing checksums.txt)
# The formula is signed on its own with the same identity.
cosign verify-blob \
--certificate "$rel/kryptkeeper.rb.pem" \
--signature "$rel/kryptkeeper.rb.sig" \
--certificate-identity "$identity" \
--certificate-oidc-issuer "$issuer" \
"$rel/kryptkeeper.rb"
for img in kryptkeeper kryptkeeper-agent kryptkeeper-certmanager kryptkeeper-mcp; do
cosign verify \
--certificate-identity "$identity" \
--certificate-oidc-issuer "$issuer" \
"ghcr.io/bpmforge/${img}:${TAG#v}"
done
cosign verify \
--certificate-identity "$identity" \
--certificate-oidc-issuer "$issuer" \
"ghcr.io/bpmforge/kryptkeeper:${TAG#v}-fips"
bash scripts/repro-check.sh sbom "$rel"
cosign verify \
--certificate-identity "$identity" \
--certificate-oidc-issuer "$issuer" \
"ghcr.io/bpmforge/charts/kryptkeeper:${TAG#v}"
# D-312: a release whose published assets do not verify says so in its
# notes instead of looking healthy.
- name: Mark the release broken on verification failure
if: failure()
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
REPO: ${{ github.repository }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
body="$(gh release view "$TAG" --repo "$REPO" --json body --jq .body)"
printf '%s\n\n> **This release failed post-publish verification.** Do not install it; see %s\n' "$body" "$RUN_URL" > "$RUNNER_TEMP/notes.md"
gh release edit "$TAG" --repo "$REPO" --notes-file "$RUNNER_TEMP/notes.md"
# Promote `latest` only after release-verify passed; never for rc/prerelease
# tags. goreleaser no longer pushes :latest (.goreleaser.yaml).
promote-latest:
name: Promote latest
runs-on: ubuntu-latest
needs: release-verify
if: ${{ !contains(github.ref_name, '-') }}
permissions:
contents: read
packages: write
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Log in to GHCR
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Point latest at the verified version
env:
TAG: ${{ github.ref_name }}
run: |
set -euo pipefail
for img in kryptkeeper kryptkeeper-agent kryptkeeper-certmanager kryptkeeper-mcp; do
docker buildx imagetools create \
-t "ghcr.io/bpmforge/${img}:latest" \
"ghcr.io/bpmforge/${img}:${TAG#v}"
done
# W32-02: Go / TypeScript / Python client SDKs generated from docs/openapi.yaml
# (scripts/gen-sdks.sh, pinned openapi-generator), compiled/typechecked, then
# attached to the GitHub Release versioned with the tag. ubuntu-latest ships
# Java (generator jar) and python3 (compileall), so no setup-java/python step.
sdks:
name: API SDKs
runs-on: ubuntu-latest
needs: goreleaser
permissions:
contents: write
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version-file: go.mod
cache: true
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version-file: ui/.nvmrc
- name: Generate, check and package SDKs
run: |
bash scripts/quote-openapi-descriptions.sh docs/openapi.yaml
bash scripts/gen-sdks.sh --version "${GITHUB_REF_NAME#v}" --check
- name: Attach SDK packages to the release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload "$GITHUB_REF_NAME" dist/sdk-release/* --clobber