Skip to content

Commit 871e352

Browse files
radroidclaude
authored andcommitted
fix(coil): make --rotate emit the CI secret commands itself (#71)
The rotation for this issue re-set T3X_MAC_CSC_PASSWORD and not T3X_MAC_CSC_P12_BASE64, so CI still holds the old certificate. The mechanism: --rotate deletes the p12 and its base64 and then points at a *separate* --print-ci-secrets invocation to regenerate them, which is one more command to remember at the exact moment the identity has already moved. It also reuses the existing p12 password, so the half that got skipped is the half with no independent signal — CI imports the old certificate cleanly and only fails a layer later, when electron-builder cannot find an identity matching CSC_NAME. Fold print_ci_secrets into the rotate path so the commands come out pre-filled with the base64 already written, and say in the runbook why the password secret surviving a rotation is a trap rather than a convenience. Setting them stays manual: the p12 holds the private key. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
1 parent 5c43328 commit 871e352

2 files changed

Lines changed: 20 additions & 5 deletions

File tree

‎docs/coil/mac-signing-runbook.md‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,21 @@ use. `disable-library-validation` in particular is what keeps the bundled native
221221
Only if the key leaks or the certificate expires (2036). It costs one round of prompts:
222222

223223
```bash
224-
scripts/coil/setup-mac-signing.sh --rotate
224+
scripts/coil/setup-mac-signing.sh --rotate # prints the next three commands, filled in
225225
scripts/coil/setup-mac-signing.sh --print-requirement > docs/coil/mac-signing/designated-requirement.txt
226226
cp ~/.t3x/mac-signing/t3x-signing.crt docs/coil/mac-signing/certificate.pem
227-
scripts/coil/setup-mac-signing.sh --print-ci-secrets # then re-set both secrets
227+
gh secret set T3X_MAC_CSC_P12_BASE64 -R radroid/t3code < ~/.t3x/mac-signing/t3x-signing.p12.base64
228228
```
229229

230230
Commit the two files in the same change. The verify step compares against the recorded requirement,
231231
so a rotation that forgets them fails the next release instead of quietly re-prompting the user.
232232

233+
`T3X_MAC_CSC_PASSWORD` survives a rotation — `--rotate` reuses the existing p12 password rather than
234+
minting a new one — which is exactly what makes the p12 secret easy to skip: CI keeps importing the
235+
_old_ certificate perfectly happily, and the failure surfaces one layer later as electron-builder not
236+
finding an identity matching `CSC_NAME`. #71's rotation skipped it. Both halves of the identity move
237+
together or neither does.
238+
233239
## Related
234240

235241
- **Issue #71 — renaming the fork to `coil`.** Done. It moved all three identities at once — bundle

‎scripts/coil/setup-mac-signing.sh‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ print_ci_secrets() {
190190
Two repository secrets. The .p12 holds the PRIVATE KEY — set them with gh, never paste them into a
191191
file in the repo:
192192
193-
gh secret set T3X_MAC_CSC_P12_BASE64 -R radroid/t3code < "$SIGNING_DIR/t3x-signing.p12.base64"
193+
gh secret set T3X_MAC_CSC_P12_BASE64 -R radroid/t3code < "$P12_PATH.base64"
194194
gh secret set T3X_MAC_CSC_PASSWORD -R radroid/t3code --body "\$(cat '$P12_PASSWORD_PATH')"
195195
196196
EOF
@@ -329,8 +329,17 @@ case "$MODE" in
329329
rm -f "$CERT_PATH" "$KEY_PATH" "$P12_PATH" "$P12_PATH.base64"
330330
create_identity
331331
log "new designated requirement: $(print_requirement)"
332-
log "Record it: scripts/coil/setup-mac-signing.sh --print-requirement > docs/coil/mac-signing/designated-requirement.txt"
333-
log "And re-set the CI secrets: scripts/coil/setup-mac-signing.sh --print-ci-secrets"
332+
log "Record it, and re-commit the certificate the release trusts:"
333+
log " scripts/coil/setup-mac-signing.sh --print-requirement > docs/coil/mac-signing/designated-requirement.txt"
334+
log " cp '$CERT_PATH' docs/coil/mac-signing/certificate.pem"
335+
log ""
336+
# Run rather than merely recommended. This block used to end at "re-set the CI secrets:
337+
# --print-ci-secrets", which is a second command to remember at the exact moment the identity
338+
# has already changed underneath CI — and #71's rotation duly re-set the PASSWORD secret and
339+
# not the p12, leaving CI importing the OLD certificate while CSC_NAME named the new one.
340+
# Emitting the commands here, with the .base64 already written, removes the step that was
341+
# skipped. They still have to be run by hand: the p12 is a private key.
342+
print_ci_secrets
334343
;;
335344
ensure)
336345
create_identity

0 commit comments

Comments
 (0)