Skip to content

chore: add optional Cloud KMS dual signing for release GPG signatures - #32209

Merged
sreya merged 7 commits into
mainfrom
kylecarbs/gpg-kms-dual-sign
Nov 16, 2026
Merged

sreya merged 7 commits into
mainfrom
kylecarbs/gpg-kms-dual-sign

Conversation

@coder

@coder coder Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Adds an optional second release signature from an RSA key held in Google Cloud KMS, so a new release signing key never exists as an exportable file.

scripts/gpgkms builds an OpenPGP key from the KMS public key and a fixed creation time, then signs through a KMS-backed crypto.Signer (ProtonMail/go-crypto, already in our module graph). When CODER_GPG_KMS_KEY and CODER_GPG_KMS_CREDENTIALS_FILE are set, sign_with_gpg.sh still writes <file>.asc with the existing GPG key exactly as before, and also writes the KMS signature to <file>.v2.asc. The .v2.asc file is verified against a keyring that holds only the KMS key before it's written. If the variables are unset, signing works as it does today.

The KMS signature goes in a separate file because every existing verifier reads .asc only:

  • vscode-coder, the Gateway plugin and Toolbox verify the first signature in .asc against a key bundled in the plugin.
  • gpg --verify exits 2 if any signature in the file is from a key it doesn't have, so appending a second signature to .asc would break customer scripts that check the exit code.

.v2.asc ships everywhere .asc does: site/out/bin (embedded in the server and served at /bin/), releases.coder.com/coder-cli/<version>/, and the GitHub release (the checksums file's signatures).

Rollout

The key (gpg-release, RSA-4096, HSM) and its identity already exist in the coder-release-signing project (coder/gcp#331). Only release-signer@ can sign with it, and only from the release (exact vX.Y.Z / vX.Y.Z-rc.N tags via release.yaml) and ci-signing (pushes to main / release/*) environments.

  1. Set these as secrets in the ci-signing environment. Set GPG_KMS_WORKLOAD_ID_PROVIDER and GPG_KMS_SERVICE_ACCOUNT in release too, but leave GPG_KMS_KEY out of release until the plugin updates and the advisory are ready:
    • GPG_KMS_KEY = projects/coder-release-signing/locations/us-central1/keyRings/release-signing/cryptoKeys/gpg-release/cryptoKeyVersions/1
    • GPG_KMS_WORKLOAD_ID_PROVIDER = projects/720429782538/locations/global/workloadIdentityPools/github-release-signing/providers/coder-coder
    • GPG_KMS_SERVICE_ACCOUNT = release-signer@coder-release-signing.iam.gserviceaccount.com
  2. Merge. release.yaml and ci.yaml get a second google-github-actions/auth step for release-signer@ with export_environment_variables: false. Its credentials file goes only to gpgkms, through CODER_GPG_KMS_CREDENTIALS_FILE. EV signing (explicit GCLOUD_ACCESS_TOKEN) and the gcloud storage upload keep the code signing account's default credentials. Every KMS step is skipped while the GPG_KMS_KEY secret is unset, on ci.yaml runs that aren't pushes, and on release.yaml dry runs from branches, because the identity provider won't issue a token for those.
  3. The key's creation time is pinned in scripts/gpgkms (1794787200, 2026-11-16 00:00 UTC) because it's part of the fingerprint.
  4. The first main build prints the public key and fingerprint to the job summary. No human can sign with the key, so CI makes the self-signature. Confirm the next main build prints the same fingerprint, and check the UID, RSA-4096 and the expiry.
  5. Release plugin updates that bundle both keys and verify <bin>.v2.asc with the new key when the server has it, falling back to <bin>.asc with the old key otherwise. Publish the new key (release.key as one armored block with both keys, keys.openpgp.org, docs).
  6. Cutover, in a later release: sign .asc with the new key, keep .v2.asc, and revoke the old key.

Testing

  • Unit tests use a crypto.Signer that hides its concrete key type, as the KMS signer does. They cover deterministic public key export, verification by each key, and rejection of armored or non-signature input to -prepend (no longer used by sign_with_gpg.sh).
  • sign_with_gpg.sh with KMS unset produces the same single-signature .asc as main and removes a stale .v2.asc. With CODER_GPG_KMS_KEY set, it fails without CODER_GPG_KMS_CREDENTIALS_FILE. Given a bogus credentials file, gpgkms fails on that file without falling back to ambient ADC, and no .v2.asc is written.
  • golangci-lint, shellcheck -x, and actionlint pass.
  • Not yet tested against a real Cloud KMS key. Only release-signer@ can sign, so the first main build is the first real run.

Add scripts/gpgkms, which creates OpenPGP signatures with an RSA key held
in Google Cloud KMS. When CODER_GPG_KMS_KEY and CODER_GPG_KMS_KEY_CREATED
are set, sign_with_gpg.sh signs with the existing GPG key first and appends
the KMS signature to the same .asc file, then verifies both. With the
variables unset, signing is unchanged.
@coder
coder Bot temporarily deployed to main November 15, 2026 21:08 Inactive
- Authenticate to the coder-release-signing project as release-signer@ in a
  separate google-github-actions/auth step that doesn't export environment
  variables. Its credentials file reaches gpgkms only, through
  CODER_GPG_KMS_CREDENTIALS_FILE, so EV signing and the gcloud steps keep the
  code signing account.
- Pin the OpenPGP creation time (1794787200) in gpgkms instead of taking it
  from a variable. It is part of the fingerprint and must never change.
- Print the KMS public key and fingerprint on main builds (job summary).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cjfit
cjfit temporarily deployed to main November 16, 2026 00:15 — with GitHub Actions Inactive
@cjfit
cjfit temporarily deployed to main November 16, 2026 00:16 — with GitHub Actions Inactive
GPG_KMS_KEY, GPG_KMS_WORKLOAD_ID_PROVIDER and GPG_KMS_SERVICE_ACCOUNT are
now secrets in the release and ci-signing environments. Secrets can't be
used in step conditions, so a step records whether GPG_KMS_KEY is set and
the KMS steps check its output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cjfit
cjfit temporarily deployed to main November 16, 2026 00:33 — with GitHub Actions Inactive
@cjfit
cjfit temporarily deployed to main November 16, 2026 00:33 — with GitHub Actions Inactive
…token

- Check fs.Parse errors (errcheck in lint/go/new-code).
- The coder-release-signing identity provider only accepts push events in
  ci-signing and release tags in release. ci.yaml also builds on create
  events for new release branches, and release.yaml allows dry runs from
  release/* branches; both now sign with the GPG key alone instead of
  failing at the KMS auth step. Real releases always run on a tag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cjfit
cjfit temporarily deployed to main November 16, 2026 00:46 — with GitHub Actions Inactive
@cjfit
cjfit marked this pull request as ready for review November 16, 2026 00:54
@cjfit
cjfit temporarily deployed to main November 16, 2026 00:54 — with GitHub Actions Inactive
@cjfit
cjfit temporarily deployed to main November 16, 2026 00:59 — with GitHub Actions Inactive
kylecarbs
kylecarbs previously approved these changes Nov 16, 2026
Appending a second signature to .asc breaks scripted `gpg --verify` for
anyone who only has the current key: gpg exits 2 when any signature in the
file is from an unknown key. Keep .asc exactly as before and write the KMS
signature to <file>.v2.asc, verified against a keyring that holds only the
KMS key. The Makefile copies it into site/out/bin (so the server embeds and
serves it at /bin) and release.yaml uploads it next to .asc on
releases.coder.com. publish.sh already uploads every file next to the
checksums file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cjfit
cjfit requested a review from a team November 16, 2026 01:38
@cjfit
cjfit temporarily deployed to main November 16, 2026 01:38 — with GitHub Actions Inactive
@cjfit
cjfit temporarily deployed to main November 16, 2026 01:38 — with GitHub Actions Inactive
@cjfit
cjfit temporarily deployed to main November 16, 2026 01:45 — with GitHub Actions Inactive
sreya added a commit that referenced this pull request Nov 16, 2026
The GPG dual-signing work (#32209) authenticates as the same release signer
and reads GPG_KMS_WORKLOAD_ID_PROVIDER / GPG_KMS_SERVICE_ACCOUNT; standardize
on those names so one identity has one configuration pair. The
GCP_RELEASE_SIGNING_* secrets are retired.
@sreya
sreya merged commit b83a339 into main Nov 16, 2026
29 of 30 checks passed
@sreya
sreya deleted the kylecarbs/gpg-kms-dual-sign branch November 16, 2026 01:58
@sreya
sreya temporarily deployed to main November 16, 2026 01:58 — with GitHub Actions Inactive
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 16, 2026

This branch had an error being deployed

1 failed and 1 inactive deployments
main — 5357653b Deployed Nov 16, 2026 by sreya via cla #257206
docs-preview — 5357653b Deployed Nov 16, 2026 by sreya via cleanup #79
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants