Skip to content

fix(setup): pin Hopper's macOS publisher identity before install - #2481

Merged
morluto merged 1 commit into
morluto:mainfrom
NIU-123370:fix/hopper-macos-publisher-pin
Oct 13, 2026
Merged

morluto merged 1 commit into
morluto:mainfrom
NIU-123370:fix/hopper-macos-publisher-pin

Conversation

@NIU-123370

Copy link
Copy Markdown
Contributor

Summary

rea setup --install-hopper on macOS accepted any bundle that passed codesign --verify --deep --strict and whose Info.plist said com.cryptic-apps.hopper-web-4. An ad-hoc signed bundle carrying that identifier satisfies both checks, so a substituted DMG would be copied into ~/Applications and launched with open.

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.ts
    • One owned publisher record HOPPER_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"
    • validBundle now returns a three-state verdict (verified / invalid_signature / unverified_publisher) instead of a boolean, so a broken signature and a publisher mismatch stay distinguishable.
    • The CFBundleIdentifier string read through PlistBuddy is gone. The identifier is now asserted against the sealed CodeDirectory, which an attacker cannot change by editing Info.plist.
    • macHopperInstallDisclosure.commands gains the exact requirement, so setup --dry-run shows what will be enforced.
    • New failure reason publisher_verification_failed, still returned before any copy or launch.
  • src/application/SetupInstallFailure.ts — projects that reason onto its own publisher_verification_failed code and a recovery that names the pinned identity and HOPPER_LAUNCHER_PATH. SetupHost.ts needed no change; it passes the reason through.

How the team identifier was captured

Not taken on faith and not guessed. Reproducible:

  1. curl -A rea-installer https://www.hopperapp.com/include/files-api.php?request=releases&public=true → OS X release 6.6.0, filename = .../Hopper-6.6.0-demo.dmg, file_length 34846271, file_hash 0be530f038249742590992199c7b042ea20ca955.
  2. Download the DMG: 34846271 bytes, shasum -a 1 = 0be530f038249742590992199c7b042ea20ca955 (matches the vendor metadata byte for byte).
  3. hdiutil attach -readonly -nobrowse then codesign -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.app with CFBundleIdentifier = com.cryptic-apps.hopper-web-4 reports flags=0x2(adhoc) and TeamIdentifier=not set, and passes codesign --verify --deep --strict plus the old identifier comparison. The same bundle fails the new requirement with test-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 --assess reports source=Notarized Developer ID, origin=Developer ID Application: Cryptic Apps (2AMA2753NF).

Check Result
src/application/MacHopper.test.ts + SetupInstallFailure.test.ts + tests/boundary/setup/macosHopperPublisherVerification.test.ts 13 passed
npx vitest run --project services (whole src/application) 65 files / 794 tests passed
npx vitest run --project acceptance tests/acceptance/setup/ 8 files / 48 tests passed
npx tsc --noEmit -p tsconfig.json clean
oxfmt --check on the changed files clean
oxlint on the changed files 0 errors, 1 pre-existing function-length warning (same warning on unchanged main)
npm run verify:module-boundaries passed (1679 files)
npx knip clean

The new boundary cases build a minimal .app whose 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)

Arm Killed by
Requirement replaced with a constant-true -R=1 ad-hoc signed bundle case
Pinned team changed to a wrong value real-artifact positive control
Requirement wrapped in stray quotes real-artifact positive control
Requirement line dropped from macHopperInstallDisclosure.commands disclosure guard
unverified_publisher verdict ignored by the installer publisher mismatch unit case
Publisher reason folded onto bundle_invalid projection unit case

tests/acceptance/setup/ initially failed 48 cases here on a fresh checkout. The same selection fails identically on untouched origin/main, and both go green after npm run build plus artifacts:mcp-catalog and artifacts:product-catalog. That is a missing generated-artifact effect, not this diff.

Deliberately not in this PR

Base: 17240778. Head: this branch, 1 commit, 5 files.

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.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

@greptileai review

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5 Tier: plus

[Critical impact] The PR appears safe to merge; publisher rejection happens before copying or launching.

Summary

This PR pins Hopper’s macOS bundle identifier and Apple signing team before installation.

  • Hopper installs only when its signature and pinned publisher both match.
  • Setup gives publisher mismatches their own error and recovery.

NIU-123370 explicitly deferred observed signer output because it needs shared result changes, the scheduled download canary because its workflow and download frequency need coordination, and docs/user-visible-errors.csv because another open PR touches it. These were not reported.

This review checked the code paths. It did not run tests or macOS commands.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Mounted Hopper app] --> B[Verify signature]
  B -->|Fails| C[bundle_invalid]
  B -->|Passes| D[Check pinned identifier and Apple team]
  D -->|Fails| E[publisher_verification_failed]
  D -->|Passes| F[Copy app and launch]
  C --> G[Detach image and clean temporary files]
  E --> G
  F --> G
Loading

Reviews (1) · Last reviewed commit: "fix(setup): pin Hopper's macOS publisher..." · Reviewed by Greptile

@morluto
morluto merged commit 650237e into morluto:main Oct 13, 2026
37 checks passed
@morluto morluto mentioned this pull request Oct 13, 2026
3 tasks done
@morluto morluto added bug Something isn't working area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Oct 14, 2026
@morluto morluto added area: setup Setup, packaging, upgrade, install, Doctor, and client registration provider: hopper Analysis provider / engine: hopper labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior area: setup Setup, packaging, upgrade, install, Doctor, and client registration bug Something isn't working provider: hopper Analysis provider / engine: hopper

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants