Skip to content

fix(macos): skip revoked certificates when dev-run picks a signing identity - #20

Merged
PCcoding666 merged 1 commit into
masterfrom
fix/macos-dev-run-revoked-cert
Oct 10, 2026
Merged

PCcoding666 merged 1 commit into
masterfrom
fix/macos-dev-run-revoked-cert

Conversation

@PCcoding666

Copy link
Copy Markdown
Owner

Summary

Scripts/dev-run.sh signed with the first "Apple Development" identity from security find-identity -v -p codesigning. On this machine the keychain holds two certificates with the same name, and the first one, 45490EBA…, is revoked. security verify-cert reports CSSMERR_TP_CERT_REVOKED for it.

A revoked certificate fails in a confusing way:

  • find-identity -v still lists it as valid. At most it appends (CSSMERR_TP_CERT_REVOKED), and only once revocation status is cached.
  • It still signs, and codesign --verify --strict passes.
  • But macOS refuses to launch the app. AMFI logs -420 The signature on the file is invalid, and open fails with Launchd job spawn failed (POSIX 163).

So every dev-run.sh run failed until LCT_SIGN_IDENTITY was pinned by hand to the other certificate.

Change

When LCT_SIGN_IDENTITY is not set, dev-run.sh now goes through the Apple Development identities in order:

  • It skips an identity that find-identity flags with a (CSSMERR_*) note.
  • Otherwise it exports that identity's certificate (matched by SHA-1) and skips it if security verify-cert -p codeSign -R ocsp fails. If the network is unreachable, the revocation check soft-fails, so it never rejects a good certificate.
  • It prints each skip and its reason to stderr, then uses the first identity that passes.
  • If every candidate is skipped, it exits with guidance: delete the revoked certificates or create a new one, or pin LCT_SIGN_IDENTITY.

Nothing changes when LCT_SIGN_IDENTITY is set, or when the first certificate is fine. README.md and RELEASE.md are updated to match.

Test plan

  • 3 new DevRunTests cases, using a security stub that answers find-identity, find-certificate and verify-cert:
    • a revoked first identity is skipped and the next one is used;
    • an identity flagged by find-identity is skipped without calling verify-cert;
    • when every identity is revoked, the script fails with guidance and packages nothing.
  • Mutation check: against the old dev-run.sh, all 3 new tests fail.
  • Real keychain, with the packaging step stubbed and --no-launch: the script skips 45490EBA… (CSSMERR_TP_CERT_REVOKED) and selects 0AC25BFD….
  • cd macos && ./Scripts/run_tests.sh: debug, release and -warnings-as-errors builds pass, and all 507 tests pass with 0 failures.

🤖 Generated with Claude Code

…entity

dev-run.sh signed with the first "Apple Development" identity listed by
`security find-identity -v`. That listing still counts a revoked
certificate as valid, and a revoked certificate still signs and passes
`codesign --verify`, but macOS refuses to launch the result (AMFI: "The
signature on the file is invalid"; `open` fails with "Launchd job spawn
failed", POSIX 163). With a revoked and a current certificate of the
same name in the keychain, every dev run failed that way.

Skip identities that find-identity flags with a CSSMERR_* note and
identities whose certificate fails `security verify-cert -p codeSign
-R ocsp`, report each skip, and use the first one that passes. If every
candidate is skipped, exit with guidance to delete the revoked
certificates or pin LCT_SIGN_IDENTITY.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 10, 2026 22:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@PCcoding666
PCcoding666 merged commit f0e24a5 into master Oct 10, 2026
2 checks passed
@PCcoding666
PCcoding666 deleted the fix/macos-dev-run-revoked-cert branch October 11, 2026 03:07
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.

2 participants