[PR #6700] fix(hopper): refuse downloads redirected to another origin #7393

Open
opened 2026-11-01 21:47:32 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/6700
Author: @Dextheking1
Created: 10/23/2026
Status: 🔄 Open

Base: main ← Head: fix/hopper-download-redirect-origin


📝 Commits (3)

  • 613e1d9 fix(hopper): refuse downloads redirected to another origin
  • 96915e7 test(hopper): cover download redirect origins
  • 7f1a7a8 merge main, check redirect origin per hop

📊 Changes

3 files changed (+99 additions, -3 deletions)

View changed files

➕ src/application/HopperDownload.test.ts (+77 -0)
📝 src/application/HopperDownload.ts (+4 -0)
📝 tests/process-global/hopperDownloadRedirect.test.ts (+18 -3)

📄 Description

Summary

Fix: downloadHopperPackage now refuses a response whose final URL is on a different origin than the requested URL, so Hopper downloads can no longer be redirected to an unvalidated host.

Problem and expected behavior

Setup validates Hopper download URLs up front (the Linux release parser requires the package URL origin to be exactly https://www.hopperapp.com; the macOS path requires a fixed HTTPS prefix), but downloadHopperPackage (src/application/HopperDownload.ts) called fetch with the default redirect behavior and never checked response.url. A redirect from the validated origin silently delivered the release metadata, the PGP public key, or the package itself from another host. SECURITY.md describes package URLs as restricted to the official origin; that held only for the initial URL. Expected: the origin restriction covers the response that is actually consumed. Package substitution was and remains blocked independently (pinned-fingerprint OpenPGP verification plus launcher SHA-256 on Linux, codesign designated requirement on macOS); this closes the documented-control gap, not a code substitution hole.

Change and scope

After the fetch, the final response URL's origin is compared with the requested URL's origin; a mismatch cancels the body and returns the existing refused result. Same-origin redirects are unaffected. One helper (isExpectedOrigin) plus a new unit test file. No caller changes.

Evidence and regression coverage

  • Tests added or updated: new src/application/HopperDownload.test.ts stubs fetch and covers both directions: a redirect that stays on the requested origin returns the bytes; a redirect to another origin is refused with no bytes.
  • Base reproduction or other evidence: executed with two local HTTP servers: the base fetch call shape followed a 302 cross-origin and returned the second origin's body with status 200.
  • User-visible CLI/MCP output (if applicable): a cross-origin redirect now makes the download fail with the existing not-ok result, so setup reports the download as unavailable instead of consuming it.
  • Remaining proof gaps: the real Hopper endpoint was not contacted; the mechanism was verified locally only.

Validation performed

  • npx vitest run src/application/HopperDownload.test.ts src/application/LinuxHopper.test.ts - 55 passed
  • npx vitest run src/application/AppBundleExecutable.test.ts - passed (sibling suite in the same tree)
  • node scripts/run-typescript.mjs --noEmit - clean
  • npx oxfmt --check and npx oxlint on the changed files - clean (an initial complexity warning in downloadHopperPackage was resolved by extracting the helper)
  • Note: tests/boundary/setup/linuxHopperPublisherVerification.test.ts shows 19 failures in my sandbox on the base revision as well (missing system fixture tooling); identical before and after this change.

Compatibility, safety, and release

  • Breaking changes or migration steps: if Hopper's delivery ever legitimately redirects to a different origin, downloads would start failing closed until the expected origin is updated. The documented contract already restricts downloads to the official origin, so this enforces the stated behavior.
  • Real Hopper/Ghidra, browser, or OS coverage: Hopper itself was not run; the download helper and its consumers are covered by unit tests.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: strengthens the download origin control to match SECURITY.md. No new network destinations, no process changes.

Contract and boundary impact

  • Semantic owner and earliest changed stage: see above.
  • Contribution scope fit and linked maintainer decision: ordinary fix within an existing boundary; not applicable.
  • CLI and MCP/tool-catalog contract: unchanged.
  • Provider, bridge, target-format, or platform compatibility: unchanged.
  • Evidence, artifact, provenance, or reconstruction contract: unchanged.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Author readiness

Human owner: @Dextheking1

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/6700 **Author:** [@Dextheking1](https://github.com/Dextheking1) **Created:** 10/23/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/hopper-download-redirect-origin` --- ### 📝 Commits (3) - [`613e1d9`](https://github.com/morluto/rea/commit/613e1d94319f1b17769af1c415583cf121778a63) fix(hopper): refuse downloads redirected to another origin - [`96915e7`](https://github.com/morluto/rea/commit/96915e735f10b1671dab3a55f4b9c408b8abf8b3) test(hopper): cover download redirect origins - [`7f1a7a8`](https://github.com/morluto/rea/commit/7f1a7a8d32e0c9a01a062920ac18a9b69f93ad7e) merge main, check redirect origin per hop ### 📊 Changes **3 files changed** (+99 additions, -3 deletions) <details> <summary>View changed files</summary> ➕ `src/application/HopperDownload.test.ts` (+77 -0) 📝 `src/application/HopperDownload.ts` (+4 -0) 📝 `tests/process-global/hopperDownloadRedirect.test.ts` (+18 -3) </details> ### 📄 Description ## Summary Fix: `downloadHopperPackage` now refuses a response whose final URL is on a different origin than the requested URL, so Hopper downloads can no longer be redirected to an unvalidated host. ## Problem and expected behavior Setup validates Hopper download URLs up front (the Linux release parser requires the package URL origin to be exactly `https://www.hopperapp.com`; the macOS path requires a fixed HTTPS prefix), but `downloadHopperPackage` (`src/application/HopperDownload.ts`) called `fetch` with the default redirect behavior and never checked `response.url`. A redirect from the validated origin silently delivered the release metadata, the PGP public key, or the package itself from another host. SECURITY.md describes package URLs as restricted to the official origin; that held only for the initial URL. Expected: the origin restriction covers the response that is actually consumed. Package substitution was and remains blocked independently (pinned-fingerprint OpenPGP verification plus launcher SHA-256 on Linux, codesign designated requirement on macOS); this closes the documented-control gap, not a code substitution hole. ## Change and scope After the fetch, the final response URL's origin is compared with the requested URL's origin; a mismatch cancels the body and returns the existing refused result. Same-origin redirects are unaffected. One helper (`isExpectedOrigin`) plus a new unit test file. No caller changes. ## Evidence and regression coverage - Tests added or updated: new `src/application/HopperDownload.test.ts` stubs `fetch` and covers both directions: a redirect that stays on the requested origin returns the bytes; a redirect to another origin is refused with no bytes. - Base reproduction or other evidence: executed with two local HTTP servers: the base fetch call shape followed a 302 cross-origin and returned the second origin's body with status 200. - User-visible CLI/MCP output (if applicable): a cross-origin redirect now makes the download fail with the existing not-ok result, so setup reports the download as unavailable instead of consuming it. - Remaining proof gaps: the real Hopper endpoint was not contacted; the mechanism was verified locally only. ## Validation performed - `npx vitest run src/application/HopperDownload.test.ts src/application/LinuxHopper.test.ts` - 55 passed - `npx vitest run src/application/AppBundleExecutable.test.ts` - passed (sibling suite in the same tree) - `node scripts/run-typescript.mjs --noEmit` - clean - `npx oxfmt --check` and `npx oxlint` on the changed files - clean (an initial complexity warning in `downloadHopperPackage` was resolved by extracting the helper) - Note: `tests/boundary/setup/linuxHopperPublisherVerification.test.ts` shows 19 failures in my sandbox on the base revision as well (missing system fixture tooling); identical before and after this change. ## Compatibility, safety, and release - Breaking changes or migration steps: if Hopper's delivery ever legitimately redirects to a different origin, downloads would start failing closed until the expected origin is updated. The documented contract already restricts downloads to the official origin, so this enforces the stated behavior. - Real Hopper/Ghidra, browser, or OS coverage: Hopper itself was not run; the download helper and its consumers are covered by unit tests. - Package or release metadata impact: none. - Security, privacy, process, or containment review: strengthens the download origin control to match SECURITY.md. No new network destinations, no process changes. ## Contract and boundary impact - Semantic owner and earliest changed stage: see above. - Contribution scope fit and linked maintainer decision: ordinary fix within an existing boundary; not applicable. - CLI and MCP/tool-catalog contract: unchanged. - Provider, bridge, target-format, or platform compatibility: unchanged. - Evidence, artifact, provenance, or reconstruction contract: unchanged. - Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable. - Generated metadata (`docs/public/product-catalog.json`), package, or installation impact (CI generates and validates ignored catalogs and `skills/`; edit authored instructions in `.agents/skills/reverse-engineer-anything/` and never commit build outputs): none. Expected effects (check known effects; use documentation-only on its own). Unchecked items do not establish absence; leave uncertainties visible. - [ ] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Author readiness Human owner: @Dextheking1 - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [ ] This PR addresses a concrete problem or an agreed enhancement. - [ ] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [ ] The PR has one focused outcome and the title follows `type(scope): outcome`. - [ ] Related issue is linked, or the reason for not linking one is stated above. - [ ] Tests cover changed observable behavior and meaningful failure paths. - [ ] Owning docs, contracts, and generated metadata are updated where needed. - [ ] User-visible CLI/MCP changes include representative output. - [ ] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#7393
No description provided.