Put the signing key behind a reviewed, tag-only environment - #8
Merged
Conversation
The plan had the Developer ID key as a repository secret. A repository secret is readable by any workflow in the repository on any branch, including one added by anyone with write access — and this repository is public, has two admins, and has no branch protection on main. For a token that is a bad day. For an Apple code-signing key it is somebody signing malware that macOS trusts as us, which rotation does not repair: every binary ever signed with it has to be re-signed and re-released, and users who already installed one cannot tell. The key now lives in a environment whose rules allow deployment from cli-v* TAGS only, with a required human reviewer, so it is reachable only by a tagged release a person approved. The build job names that environment; the Linux legs are gated too, which is correct — nothing in a release should ship without the same approval. MACOS-SIGNING.md gains the parts that were missing: where the private key is allowed to exist (not a box that runs agents), backing up the p12 before shredding because Apple caps Developer ID certificates, reading secret values from files rather than arguments so they stay out of ps and shell history, a revocation runbook, and the codesign incantation that lets a user verify a download came from us. Greentree-Change-Id: 35e2118c4d30b0d1e70a7cea64a5206f
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Security hardening for the signing setup, before any key material exists.
The problem with the plan as written
MACOS_*were going to be repository secrets. A repository secret is readable by any workflow in the repository, on any branch, including one added in a push by anyone with write access. This repository is public, has two admins, and has no branch protection onmain— I checked.For an ordinary token that is a bad day. For an Apple Developer ID key it is somebody signing malware that macOS trusts as us, and rotation does not repair it: every binary ever signed with the leaked key has to be re-signed and re-released, and users who already installed one have no way to know. The damage lands on users, not on our infrastructure.
What changed
Created the
release-signingenvironment on this repo with:cli-v*tags only — not from any branchlas7)and
buildnow names that environment. So the key is reachable exclusively by a tagged release that a human approved, and never by a workflow pushed to a branch.This gates the Linux legs too. Deliberate: nothing in a release should ship without the same approval, and one click per release is not worth engineering around.
MACOS-SIGNING.mdgained the parts that were missing.p12before shredding. Apple caps how many Developer ID Application certificates an account may hold, so "just make another" is not free, and revoking one invalidates signatures made with it.psto every other process and lands in shell history. All sixgh secret setcalls now redirect from files.codesign -dvauthority and team ID, which is what makes a stolen-certificate build detectable by someone other than us.Note on the key I generated earlier
I generated a key and CSR at
~/.reachpad-signingon the devbox to save a step. That box runs coding agents with shell access, so by the standard this document now sets, it is the wrong place. Recommend discarding it and generating on your laptop — it costs thirty seconds. Nothing has been uploaded to Apple yet, so there is nothing to revoke.