17 KiB
Container image signing model (D-101)
Current state (W20-02, v0.9.0): the public release path is keyless again.
release.yml(driven by.goreleaser.yaml) signschecksums.txtand the image manifests keyless with cosign, using the workflow's GitHub OIDC identity. It uses noCOSIGN_KEY, and there is no public key to distribute and no signing key pending. External consumers verify with--certificate-identity-regexpand--certificate-oidc-issuer https://token.actions.githubusercontent.com; seedocs/deployment.md, "Install from a signed release".The keyed model below is historical for the release path and is still accurate only for the internal pipeline:
release-candidate.ymlsigns withCOSIGN_KEY, andpromote-by-digest.yml/rollback-by-digest.ymlverify withcosign verify --key. Those images are internal staging artifacts, not the published release. Statements below thatrelease.ymlsigns keyed, or that external verification is impossible, no longer apply to tagged releases.
FR-P63 / D-101: .github/workflows/release.yml and .github/workflows/release-candidate.yml
used to sign the ghcr.io/bpmforge/kryptkeeper image two different ways —
release.yml signed keyless (Sigstore/Fulcio, via the workflow's GitHub
OIDC token), release-candidate.yml signed keyed (a static cosign key
pair held in COSIGN_KEY/COSIGN_PASSWORD). That inconsistency is resolved
here: both workflows now sign keyed, with the same key pair.
Why keyed won, not keyless
The deciding constraint isn't a style preference, it's that promote-by-digest.yml
and rollback-by-digest.yml (both out of this ticket's write_scope) already
verify with:
cosign verify --key cosign.pub "$IMAGE_DIGEST"
--key verification only works against a keyed signature. A Sigstore keyless
signature (Fulcio-issued cert + Rekor transparency-log entry, no static key)
cannot be verified with cosign verify --key — the deploy pipeline would
have to switch to --certificate-identity/--certificate-oidc-issuer
verification instead, and those two files cannot be touched from this
ticket's write_scope. Making release.yml keyed (matching what the
deploy pipeline already assumes) is the only reconciliation reachable from
here without breaking promotion/rollback. If a future ticket wants to move
the whole pipeline to keyless, it must touch promote-by-digest.yml and
rollback-by-digest.yml in the same change — signing model and verification
model are one contract, not two independently-versionable things.
Cost of this choice, stated plainly: public consumers who pull
ghcr.io/bpmforge/kryptkeeper from a tagged release lose Sigstore/Rekor
public-transparency verification (cosign verify --certificate-identity ...
against the public log) and instead need Kryptkeeper's public key
out-of-band to verify anything. That is a real regression in the
zero-trust-key story keyless signing gives public OSS consumers, accepted
here because the internal promote/rollback pipeline's --key-only
verification is the binding constraint and is out of reach to change.
Revisit if promote-by-digest.yml/rollback-by-digest.yml are ever
opened for other reasons.
Key custody
- Generation. The key pair is generated once with
cosign generate-key-pairon an operator's local machine (never inside CI) — this producescosign.key(encrypted with a password) andcosign.pub. Do not generate it inside a GitHub Actions job; a job that can generate the key can exfiltrate it. - Private half custody.
cosign.key's contents go into the GitHub Actions repository secretCOSIGN_KEY; its password goes intoCOSIGN_PASSWORD. Both are repo-level encrypted secrets, readable only by workflow runs (sign-and-attestinrelease-candidate.yml,dockerinrelease.yml) — not by PR-triggered workflows from forks, since neither workflow that reads these secrets runs onpull_request. Nobody with only repo write access can read secret values back out through the GitHub UI/API; only repo admins can update them (rotate) and only by overwriting blind (GitHub never displays a stored secret's value). Keep an offline copy ofcosign.key+ its password in the org's secret-management system (the same tier used for the CA root/HSM key custody documented elsewhere, e.g.docs/DECISIONS.mdD-085/D-089) — GitHub secrets are the runtime copy, not the only copy; losing the GitHub copy without an offline backup makes every previously-signed artifact's public key unrecoverable-but-still-valid (you can still verify old signatures, you just can't produce new ones under the same key without regenerating and redistributing a new public key). - Public half distribution — the gap keyed-only creates. A keyless
signature is self-describing (the Fulcio cert + Rekor log entry travel
with it); a keyed signature is not — anyone who wants to verify a released
image needs
cosign.pubfrom somewhere they trust. Today that "somewhere" is the GitHub Actions secretCOSIGN_PUBLIC_KEY, used only insidepromote-by-digest.yml/rollback-by-digest.ymlfor Kryptkeeper's own internal staging/production deploys. There is currently no public distribution channel forcosign.pubfor an external consumer of a tagged GHCR release to verify against — that is the direct cost of dropping keyless for the public release path. Until a public channel exists (e.g. publishingcosign.pubas a release asset, or in this repo under a well-known path), external verification ofv*release images is not possible; say so rather than imply it works. Publishingcosign.pubas a release asset is a natural, small follow-up (append a step torelease.yml'sreleasejob) — not done here because "distribution packaging" acceptance criteria are silent on it and this file's job is to name the gap accurately, not quietly close it. COSIGN_PUBLIC_KEYmust be the pair ofCOSIGN_KEY. These are two separately-set GitHub secrets — nothing enforces they came from the samecosign generate-key-pairrun. If they drift (e.g.COSIGN_KEYrotated without updatingCOSIGN_PUBLIC_KEY),cosign verify --keyinpromote-by-digest.yml/rollback-by-digest.ymlfails closed — that's the correct failure mode (a promotion that can't verify its image's signature must not deploy it), but it will look like an unrelated outage if the two secrets aren't rotated together. Rotate them in the same change, and smoke-test aworkflow_dispatchpromote against a known-good digest immediately after.- Rotation. Generate a new pair, add the new public half as
COSIGN_PUBLIC_KEY, and keep both the old and new key material available until every image signed under the old key has rolled out of production and staging (promote-by-digest.yml/rollback-by-digest.ymlcan only verify against whichever single public key is currently inCOSIGN_PUBLIC_KEY— there is no multi-key verification today). UpdateCOSIGN_KEY/COSIGN_PASSWORDto the new private half only once nothing still needs signing under the old one. A rollback to an image signed under a since-rotated-out key will fail signature verification by design — keep the previous key pair in offline escrow for exactly this case rather than discarding it at rotation time.
What changed in the workflows
release.yml:dockerjob now runscosign sign --yes --key cosign.key(same invocation shape asrelease-candidate.yml'ssign-and-attestjob —umask 077, write the key from the secret,rm -f cosign.keyafter), gated behind the same "secrets configured" fail-closed check.id-token: writeis removed from workflow-levelpermissions— it was only ever there for keyless signing (Fulcio OIDC exchange) and is dead permission now.release-candidate.yml: unchanged behavior (it was already keyed); a comment now points here so a future reader doesn't have to reconstruct why the two workflows match.
Delivery plugin signing (W20-24, D-117)
Delivery plugins are signed with a separate plugin-signing key, not the image key above: a leaked plugin key must not be able to sign a hub image, and the reverse.
-
Scheme.
cosign sign-blobover the exact bytes of the plugin'smanifest.json. The manifest pins the module's SHA-256 and declares its capabilities, so one signature covers the code and what it may do. The hub verifies offline with the Go standard library (ECDSA P-256 over SHA-256); there is no Rekor or Fulcio lookup and no network. It accepts the sigstore bundle cosign v3 writes by default, or a bare base64 signature. With cosign older than v3, use--output-signature(the v2--bundleJSON is a different format and is refused). -
Generate once, on an operator's machine, never in CI:
cosign generate-key-pair --output-key-prefix kk-plugin. This giveskk-plugin.key(password-encrypted) andkk-plugin.pub. -
Private half custody.
kk-plugin.keyand its password stay with the release owner. They are not a CI secret until a release pipeline signs plugins; until then plugins are signed locally. The key file is password-encrypted (cosign's scrypt + secretbox), so a copy of the file alone cannot sign; the password is the secret to guard.- Working copy:
~/.config/kryptkeeper-signing/kk-plugin.key(mode 600, directory 700) on the release owner's Mac.scripts/sign-plugins.shreads it from there by default (KK_PLUGIN_KEYoverrides). - Backup:
Bkup/kryptkeeper-signing/on offline backup storage share, withkk-plugin.pub. That share is mounted as guest, so treat the copy as readable by anyone on the LAN: it is safe only while the password is strong and kept elsewhere (a password manager, never next to the file). - Generated 2026-10-08. Never commit either file:
*.keyis gitignored, and the public half lives only inplugin_signing_keys.txt.
- Working copy:
-
Public half.
kk-plugin.pubgoes intointernal/bootstrap/plugin_signing_keys.txt, compiled into the hub. Only a key in that file makes a pluginfirst-party; operators cannot add one. Operators trust other publishers withKRYPTKEEPER_PLUGIN_TRUSTED_KEYS(tierverified); see docs/ops/DELIVERY_PLUGINS.md. -
Sign with
scripts/sign-plugins.sh: it runsmake plugins, signs eachdist/plugins/<name>/manifest.json(cosign asks for the password), and verifies every bundle against the key compiled into the hub, stopping on the first mismatch. It refuses to run on a tree with uncommitted changes: Go stamps the git state into each module, and plugin builds are reproducible only from a clean checkout of a commit (a clean rebuild of be88843 reproduced the signed modules' sha256 exactly). Record the commit the script prints with the release. By hand, aftermake pluginshas pinned the manifest:cosign sign-blob --key kk-plugin.key --bundle manifest.json.bundle \ --signing-config scripts/cosign-signing-config.json manifest.jsonscripts/cosign-signing-config.json(made withcosign signing-config createand no services) names no transparency log or timestamp authority, which keeps the signature off the public log while the repository is private; the hub does not consult the log either way. It replaces--tlog-upload=false, which cosign v3 deprecates. Shipmanifest.json.bundlenext tomanifest.jsonandplugin.wasm. -
Catalogue (W38-11, D-328). The plugin catalogue (
catalogue.json) is signed with this same key, ascatalogue.json.bundle, and the hub verifies it against the same compiled-in key, so the catalogue adds no trust root. Theplugin-cataloguejob inpackaging/public/github-release.ymlis the first CI use of the key: it needs repository secretsPLUGIN_SIGNING_KEY(thekk-plugin.keycontents) andPLUGIN_SIGNING_PASSWORD. Adding them is the release owner's decision, since this file previously kept the key out of CI; the key file is password-encrypted, so the password is the part to guard. Until the secrets exist the job fails with a message and signing stays local. -
Rotation. Add the new public key to
plugin_signing_keys.txtbeside the old one, sign new releases with the new key, and drop the old key after one release. Versions already installed keep their recordedsigner_key_id. -
Compromise. Remove the key from
plugin_signing_keys.txtand ship a hub release; disable any plugin version signed by it (signer_key_idin the plugin API) until it is re-signed and reviewed.
Package repository signing (apt/yum)
W25-11. The apt and yum repositories at https://pkg.kryptkeeper.io (see
packaging/repo/README.md) are signed with a dedicated GPG key. This is a
separate trust root from the keyless cosign signatures on release assets:
cosign proves a release artifact came from this repo's release.yml; the GPG
key proves the repository metadata (InRelease, Release.gpg,
repomd.xml.asc) was produced by the publisher. The publish workflow checks
the former before it applies the latter, and never weakens either.
- Generation. Once, offline, never in CI:
gpg --quick-generate-key "Kryptkeeper Package Signing <contact@kryptkeeper.io>" rsa4096 sign 2y. Fingerprint:PENDING-OWNER(the key is created by the owner, not by an implementer). - Private half. GitHub secrets
PKG_REPO_GPG_PRIVATE_KEY(ASCII-armored) andPKG_REPO_GPG_PASSPHRASE; offline backup in the same tier ascosign.key(see "Key custody" above). The workflow imports it into a throwawayGNUPGHOME, deletes that directory in analways()step, and fails rather than publish if the secret is empty. The passphrase is only ever fed on stdin (--passphrase-fd 0). - Public half. Published as
kryptkeeper.ascandkryptkeeper.gpgat the repo root; fingerprint printed inpackaging/repo/README.mdand in the release notes. Consumers pin it via aptsigned-by/ dnfrepo_gpgcheck=1. - Hosting credentials.
CLOUDFLARE_API_TOKEN(scope: Cloudflare Pages Edit on the one account) andCLOUDFLARE_ACCOUNT_IDdeploy to thekryptkeeper-pkgPages project. They can replace the published repo, so they are as sensitive as the signing key; rotate on suspected exposure. - Scope. Repository metadata is signed. Individual
.rpmfiles are not (gpgcheck=0,repo_gpgcheck=1); rpm signing (rpmsign --addsign) is a follow-up. - Rotation. Generate a new key, publish a keyring containing old and new for one release, then drop the old key.
- Compromise. Revoke the key, generate a new one, republish the whole repo (the workflow rebuilds it from the verified release assets), and announce the new fingerprint.
Verify a release and reproduce it (W33-09)
Every release is signed keyless by .github/workflows/release.yml. The
release-verify job re-checks all of it right after publish (identity below,
issuer https://token.actions.githubusercontent.com); if it fails, the run
fails and promote-latest is skipped, so :latest keeps pointing at the
previous release (goreleaser no longer pushes :latest; rc/prerelease tags
never get it).
Verify by hand (replace vX.Y.Z):
ID="https://github.com/bpmforge/kryptkeeper/.github/workflows/release.yml@refs/tags/vX.Y.Z"
ISS=https://token.actions.githubusercontent.com
gh release download vX.Y.Z --repo bpmforge/kryptkeeper --dir rel
cosign verify-blob --certificate rel/checksums.txt.pem --signature rel/checksums.txt.sig \
--certificate-identity "$ID" --certificate-oidc-issuer "$ISS" rel/checksums.txt
(cd rel && sha256sum --check --ignore-missing checksums.txt)
cosign verify --certificate-identity "$ID" --certificate-oidc-issuer "$ISS" ghcr.io/bpmforge/kryptkeeper:X.Y.Z
Reproduce the linux/amd64 binaries: bash scripts/repro-check.sh rebuild
(needs goreleaser v2.18.3) clones HEAD into two different directories, builds
the four binaries in each and prints a MATCH/DIFF SHA-256 table. Builds
are reproducible because -trimpath, CGO_ENABLED=0, mod_timestamp and
main.date are all derived from the commit time ({{ .CommitTimestamp }} /
{{ .CommitDate }}), never the wall clock. The reproducible-build.yml
workflow runs the same check on every v* tag. The Windows agent and MSI are
not reproducible and are not covered.
SBOM completeness: bash scripts/repro-check.sh sbom <dir> requires every
module linked into the four shipped commands (go list -deps) to appear in
the CycloneDX SBOMs, and reports how many other go list -m all modules
(test-only or unlinked) are absent; those cannot appear in a binary SBOM.
Release signing on the self-hosted forge (D-210)
the self-hosted forge has no OIDC issuer, so releases are signed with a cosign key pair:
checksums.txt and kryptkeeper.rb get a .sig. The public key is
packaging/cosign.pub; verify with
cosign verify-blob --key cosign.pub --signature checksums.txt.sig checksums.txt.
The private key and its password live only in the the self-hosted forge repo secrets
COSIGN_PRIVATE_KEY and COSIGN_PASSWORD, plus the owner's offline copy.