Repository navigation
fix(setup): pin Hopper's macOS publisher identity before install - #2481
Conversation
The macOS installer accepted any bundle that passed `codesign --verify` and whose `Info.plist` said `com.cryptic-apps.hopper-web-4`. An ad-hoc signed bundle with that identifier satisfies both, so a substituted DMG could be copied to ~/Applications and launched. Verify a pinned code requirement instead, covering the sealed bundle identifier and the signing team together, and report a distinct `publisher_verification_failed` code so a vendor key change is not confused with a corrupt package.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
@greptileai review |
|
Summary
rea setup --install-hopperon macOS accepted any bundle that passedcodesign --verify --deep --strictand whoseInfo.plistsaidcom.cryptic-apps.hopper-web-4. An ad-hoc signed bundle carrying that identifier satisfies both checks, so a substituted DMG would be copied into~/Applicationsand launched withopen.This implements the option you specified in the review note on #1681: verify a pinned code requirement covering the sealed bundle identifier and the signing team together, and report a distinct failure code so a vendor key change is not confused with a corrupt package.
Refs #1681
What changed
src/application/MacHopper.tsHOPPER_PUBLISHER(bundle identifier + Apple team), and a code requirement built only from it:= identifier "com.cryptic-apps.hopper-web-4" and anchor apple generic and certificate leaf[subject.OU] = "2AMA2753NF"validBundlenow returns a three-state verdict (verified/invalid_signature/unverified_publisher) instead of a boolean, so a broken signature and a publisher mismatch stay distinguishable.CFBundleIdentifierstring read throughPlistBuddyis gone. The identifier is now asserted against the sealed CodeDirectory, which an attacker cannot change by editingInfo.plist.macHopperInstallDisclosure.commandsgains the exact requirement, sosetup --dry-runshows what will be enforced.publisher_verification_failed, still returned before any copy or launch.src/application/SetupInstallFailure.ts— projects that reason onto its ownpublisher_verification_failedcode and a recovery that names the pinned identity andHOPPER_LAUNCHER_PATH.SetupHost.tsneeded no change; it passes the reason through.How the team identifier was captured
Not taken on faith and not guessed. Reproducible:
curl -A rea-installer https://www.hopperapp.com/include/files-api.php?request=releases&public=true→OS Xrelease6.6.0,filename=.../Hopper-6.6.0-demo.dmg,file_length34846271,file_hash0be530f038249742590992199c7b042ea20ca955.shasum -a 1=0be530f038249742590992199c7b042ea20ca955(matches the vendor metadata byte for byte).hdiutil attach -readonly -nobrowsethencodesign -dvvv "Hopper Disassembler.app"→Authority=Developer ID Application: Cryptic Apps (2AMA2753NF),TeamIdentifier=2AMA2753NF,flags=0x10000(runtime).The capture command and artifact identity are recorded in the comment above the constant.
Verification (all run in this session)
Reproducing the gap first, on a locally built bundle: an ad-hoc signed
Hopper Disassembler.appwithCFBundleIdentifier = com.cryptic-apps.hopper-web-4reportsflags=0x2(adhoc)andTeamIdentifier=not set, and passescodesign --verify --deep --strictplus the old identifier comparison. The same bundle fails the new requirement withtest-requirement: code failed to satisfy specified code requirement(s)(exit 3).Positive control, so a quoting or argument mistake cannot hide behind the rejection arms: the real mounted artifact passes
codesign --verify --deep --strict -R"<requirement>".spctl --assessreportssource=Notarized Developer ID,origin=Developer ID Application: Cryptic Apps (2AMA2753NF).src/application/MacHopper.test.ts+SetupInstallFailure.test.ts+tests/boundary/setup/macosHopperPublisherVerification.test.tsnpx vitest run --project services(wholesrc/application)npx vitest run --project acceptance tests/acceptance/setup/npx tsc --noEmit -p tsconfig.jsonoxfmt --checkon the changed filesoxlinton the changed filesmain)npm run verify:module-boundariesnpx knipThe new boundary cases build a minimal
.appwhose launcher is a copy of/usr/bin/true, so they need no compiler: ad-hoc signed with the pinned identifier →unverified_publisher; unsigned →invalid_signature; signed then appended to →invalid_signature; plus a guard that the disclosure still carries the exact requirement.One case is opt-in:
REA_HOPPER_MACOS_APP=<mounted app path> npx vitest run --project boundary tests/boundary/setup/.... It was run here against the real artifact and passed in 4.7 s. It is skipped by default because CI would need a DMG download.Mutation arms (each arm run, each killed exactly one case)
-R=1macHopperInstallDisclosure.commandsunverified_publisherverdict ignored by the installerbundle_invalidtests/acceptance/setup/initially failed 48 cases here on a fresh checkout. The same selection fails identically on untouchedorigin/main, and both go green afternpm run buildplusartifacts:mcp-catalogandartifacts:product-catalog. That is a missing generated-artifact effect, not this diff.Deliberately not in this PR
SetupHopperInstallResultonly carriescodeandremediation, so surfacing it means adding a field to that shared shape and editingSetupHost.ts, which is currently touched by fix(setup): resolve the configuration MSIX Claude Desktop reads #2426, feat(setup): support private Claude Code project registrations #2414 and fix(setup): separate host support and stop skill checks after drift #2073. The remediation text names the expected identity instead. I will add the observed subject in a follow-up on request..github/workflows/real-hopper.ymlis occupied by ci: pin GitHub Actions to full commit SHAs #1901. That also needs your call on download frequency, per open question 2 in [Design] Pin the Hopper publisher identity in the macOS installer #1681.docs/user-visible-errors.csvis an audit table with no guard test keyed on these codes, and it is touched by an open PR, so it is left alone.Base:
17240778. Head: this branch, 1 commit, 5 files.