Refuse to sign a release with the wrong Sparkle key - #23
Merged
Merged
Conversation
SUPublicEDKey is baked into every shipped bundle, and Sparkle reads exactly one of them -- no key list, no secondary key, no overlap window. A release signed with a key the bundle does not trust is not degraded, it is rejected by every installed copy, and there is nothing that routes those users back to a working item. They are stranded until they reinstall by hand. The accidental route is specific: the key lives in the login keychain under account dev.wouter.dontmiss, not the tooling's default ed25519, so generate_keys finds nothing, reports no conflict, and mints a new key. A key restored to the wrong account on a new machine gets there too, as does a mistyped secret. The release job now derives the signing key's public half and compares it to the bundle's SUPublicEDKey before the key is used for anything. Sparkle stores a 32-byte seed, so this needs real curve arithmetic: LibreSSL, which is what /usr/bin/openssl is on macOS, cannot do it, and depending on a Homebrew OpenSSL being on the runner is a worse bet than 20 lines of RFC 8032. The script checks its own arithmetic against the RFC's test vector first, so a reported mismatch is a statement about the key rather than about the script. CI exercises both directions without holding the real key: a random key must be refused, and a bundle stamped with that key's public half must be accepted. A guard that never refuses is worse than no guard, since it reads as protection. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
SUPublicEDKeyis baked into every shipped bundle and Sparkle reads exactly one of them — no key list, no secondary key, no overlap window. Signing a release with a key the bundle doesn't trust doesn't degrade anything; it produces an update every installed copy rejects, and Sparkle has no mechanism to route those users back to a working item. They're stranded until they reinstall by hand.The accidental route is specific and live: the key sits in the login keychain under account
dev.wouter.dontmiss, not the tooling's defaulted25519.So
generate_keysconcludes no key exists, reports no conflict, and silently mints a new one. A key restored to the wrong account on a new machine reaches the same place, as does a mistyped secret.What this adds.
scripts/check-signing-key.shderives the signing key's public half and compares it to the bundle'sSUPublicEDKey, andrelease.ymlruns it before the key is used for anything.Sparkle stores a 32-byte seed, so this needs actual curve arithmetic.
/usr/bin/opensslis LibreSSL and can't do it; Homebrew's OpenSSL 3 can, but depending on it being present on a runner is a worse bet than 20 lines of RFC 8032. The script verifies its own arithmetic against the RFC's test vector before judging anything, so a reported mismatch is a statement about the key and not about the script.CI exercises both directions without the real key — a random key must be refused, and a bundle stamped with that key's public half must be accepted. A guard that never refuses is worse than no guard, because it reads as protection.
Verified locally against the real key: accepts it, refuses a random one with exit 1, and
--print-publicon the 1Password key reproduces theSUPublicEDKeyin the app currently installed in /Applications.🤖 Generated with Claude Code