Skip to content

release: signed by spin-stack's KMS key, as OpenPGP, from the release environment - #4

Merged
aledbf merged 4 commits into
mainfrom
kms-signing
Nov 17, 2026
Merged

aledbf merged 4 commits into
mainfrom
kms-signing

Conversation

@aledbf

@aledbf aledbf commented Nov 17, 2026

Copy link
Copy Markdown
Member

The registries (registry.terraform.io, registry.opentofu.org) only take a release whose SHA256SUMS is signed with an OpenPGP key they hold for spin-stack. The key is a KMS key, created by spin-stack/ci#18, and its private half never leaves KMS.

  • internal/kmspgp: the OpenPGP key of an RSA KMS key. It's a v4 key with a fixed creation time (Created), and KMS self-signs its user id spin-stack (terraform-provider-spin releases). The same KMS key always gives the same key byte for byte (go-crypto's random salt notation is turned off; it guards EdDSA and does nothing for RSA PKCS#1 v1.5). So the public key a registry was given once is the one every later release is checked against. Signing sends KMS the SHA-256 digest (RSASSA_PKCS1_V1_5_SHA_256, MessageType: DIGEST) and writes a detached binary signature, as gpg --detach-sign does.
  • Verified with GnuPG (TestGnuPGVerifiesTheSignature): gpg --import of the printed key, then gpg --verify gives Good signature from "spin-stack (terraform-provider-spin releases)", and fails over other bytes.
  • go-crypto loses the signer's own error (a shadowed err in Signature.Sign), so the KMS refusal is kept and reported instead of "need to call Sign".
  • internal/cmd/kmspgp: public prints the armored key and its fingerprint, for the registries. sign -out <sig> <file> is what GoReleaser runs.
  • release.yml runs in the release environment, which GitHub lets only v* tags deploy to (already created). It assumes terraform-provider-spin-release (ci#18) by OIDC. There's no GPG secret.

A local GoReleaser snapshot (without signing or publishing) builds every zip with LICENSE and THIRD_PARTY_NOTICES. Tests pass, mutate: 12 refused, 0 survived.

Order: ci#18 is applied first (Deploy). Then go run ./internal/cmd/kmspgp -key alias/terraform-provider-spin-signing public with that account's credentials prints the key for both registries, and the v0.1.0 tag publishes.

🤖 Generated with Claude Code

aledbf and others added 4 commits November 17, 2026 14:37
… environment

The registries take a release only with SHA256SUMS signed by an OpenPGP
key they hold. The key is a KMS key (spin-stack/ci's signing.tf) whose
private half never leaves KMS: kmspgp makes the OpenPGP key of it - its
user id self-signed by KMS, the same key byte for byte every time, so
the public half a registry was given once is what every release is
checked against - and signs the checksums by asking KMS. GnuPG verifies
what it signs. The release job assumes the one role that may sign, from
the release environment, which only a v* tag deploys to.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… exempt

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e held

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aledbf
aledbf merged commit 0a1062d into main Nov 17, 2026
1 check passed
@aledbf
aledbf deleted the kms-signing branch November 17, 2026 17:41
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.

1 participant