Skip to content

ci: sign releases with the Developer ID keys in Cloud KMS - #287

Draft
kylecarbs wants to merge 3 commits into
mainfrom
kms-signing
Draft

kylecarbs wants to merge 3 commits into
mainfrom
kms-signing

Conversation

@kylecarbs

@kylecarbs kylecarbs commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Signs the Coder Desktop app with the Developer ID Application key coder/coder already uses, which lives in Google Cloud KMS (apple-codesign/developer-id-application), instead of the PKCS#12 in repository secrets. The .pkg keeps its existing Developer ID Installer certificate, moved from repository secrets to the signing environment.

How

Apple's codesign can't use a Cloud KMS key, and the Cloud KMS PKCS#11 library only ships for Linux, so release.yml alternates between macOS and Linux:

Job Runner Does
build macOS Builds the app unsigned (CODE_SIGNING_ALLOWED=NO) and embeds the provisioning profiles
rcodesign Linux Builds rcodesign with PKCS#11 support at the revision coder/coder pins, with the same patch
sign-app Linux, signing env scripts/sign.sh app: Developer ID Application key in KMS
package macOS Verifies the signature with codesign (including the Helper's XPC requirement), then pkgbuild
sign-pkg Linux, signing env scripts/sign.sh pkg: existing Developer ID Installer PKCS#12; scripts/notarize.sh: notarize and staple
publish macOS, signing env pkgutil/stapler/spctl checks, Sparkle signature, release assets, appcast

scripts/sign.sh app reproduces Xcode's Developer ID export:

  • Coder's executables (app, Helper, VPN extension, VPNLib, CoderSDK) get the hardened runtime and the entitlements in signing/entitlements/. Those are copied from v0.8.5.
  • Prebuilt binaries (Sparkle, mutagen, the Swift runtime) keep their identifiers, flags and entitlements.

I checked this by taking the v0.8.5 app, stripping the signatures from Coder's binaries and signing it with sign.sh and a throwaway certificate:

  • All 13 Mach-O files match v0.8.5 in identifier, flags and DER entitlements.
  • The same 18 bundles are sealed.

The designated requirements still pin team 4399GN35BJ, so Sparkle updates, the system extension and the Helper's XPC check are unaffected.

scripts/sign.sh pkg re-signs a pkgbuild output with the PKCS#12. rcodesign only reads legacy-encrypted PKCS#12 files, so the script re-encodes the file with openssl first. I tested it with both modern and legacy PKCS#12 files.

Other changes:

  • Notarization uses an App Store Connect API key instead of an Apple ID and app-specific password.
  • sign_update comes from Sparkle 2.7.0's SwiftPM zip, checked against the checksum in Sparkle's Package.swift.
  • The Application certificate (public) is committed in signing/.
  • make release now builds an unsigned app, with no keychain.

Before merging

  1. coder/gcp#355 is applied: a desktop-macos-signer identity that only this workflow can use, in the signing environment, on main or a published vX.Y.Z release.
  2. coder/github-org-terraform#67 is applied: the signing environment (main and v* tags).
  3. Secrets in the signing environment:
    • APPLE_INSTALLER_PKCS12_B64 and APPLE_INSTALLER_PKCS12_PASSWORD: the existing Installer certificate, from 1Password;
    • AC_APIKEY_ISSUER_ID, AC_APIKEY_ID and AC_APIKEY_P8_BASE64: the same App Store Connect key coder/coder uses;
    • SPARKLE_PRIVATE_KEY.

After merging, run release on main with dryrun, check the artifact, then delete these repository secrets:

  • APPLE_DEVELOPER_ID_PKCS12_B64 and APPLE_DEVELOPER_ID_PKCS12_PASSWORD
  • APPLE_INSTALLER_PKCS12_B64 and APPLE_INSTALLER_PKCS12_PASSWORD (the copies now in the environment replace them)
  • APPLE_NOTARYTOOL_USERNAME and APPLE_NOTARYTOOL_PASSWORD
  • SPARKLE_PRIVATE_KEY

Dry runs now only sign from main.

🤖 Generated with Claude Code

kylecarbs and others added 3 commits November 16, 2026 10:53
The Developer ID Application and Installer keys now live in Google Cloud
KMS. Apple's codesign can't use them, so release.yml builds the app
unsigned on macOS, signs it on Linux with rcodesign through the Cloud KMS
PKCS#11 library, packages it on macOS, then signs, notarizes and staples
the installer on Linux. The signing jobs run in the signing environment,
the only one the desktop-macos-signer identity trusts.

Notarization uses an App Store Connect API key instead of an Apple ID
password, and the public certificates and release entitlements are
committed in signing/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Apple issues the Developer ID Installer certificate for the same Cloud KMS
key as the Application certificate, so both signing steps select
developer-id-application and only the certificate differs.

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

Keep the Developer ID Installer key in the PKCS#12 it already ships in,
moved to the signing environment; only the Developer ID Application key
is in Cloud KMS. rcodesign only reads legacy-encrypted PKCS#12 files, so
sign.sh re-encodes the file with openssl first.

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

This branch has not been deployed

No deployments
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