Skip to content

fix(install): prevent interactive installs from consuming stored IPAs - #196

Merged
bitxeno merged 1 commit into
bitxeno:masterfrom
YellowNest:fix/interactive-ipa-path-confinement
Oct 7, 2026
Merged

bitxeno merged 1 commit into
bitxeno:masterfrom
YellowNest:fix/interactive-ipa-path-confinement

Conversation

@YellowNest

Copy link
Copy Markdown
Contributor

Problem

The interactive install WebSocket trusts the client-provided local ipa_path for Apple ID installs. External-certificate requests validate local paths, but currently accept both the upload directory and the persistent installed-app directory.

That is unsafe for an interactive install because SaveApp moves the successful request's IPA into the destination app record. A client can therefore point an install request at another record's <data>/ipa/<id>/app.ipa; if the install succeeds, that persistent IPA is moved away from the original record. The victim record is then left pointing at a missing package, breaking later reinstall/refresh operations. Apple ID requests can currently name any process-readable local path, not just atvloadly-managed uploads.

The normal install UI does not need this authority:

  • file installs receive their local path from POST /api/upload, under <data>/tmp;
  • URL installs use HTTP(S);
  • source installs are downloaded server-side;
  • reinstall/refresh of an already-installed app uses the task pipeline, not this interactive WebSocket.

Fix

Constrain every interactive local IPA path to a regular file that resolves inside <data>/tmp.

  • Apply the same invariant to Apple ID and external-certificate WebSocket installs.
  • Reuse the existing symlink-safe resolvePathWithin path resolver.
  • Preserve CodeIPAPathRejected so external-signing error reporting remains consistent.
  • Leave ResolveClientIPAPath unchanged for internal/background flows that legitimately reuse a stored IPA.
  • Leave HTTP(S) install URLs unchanged.

This prevents a WebSocket request from borrowing, moving or overwriting an installed app's persistent package without changing supported UI behavior.

Regression coverage

TestValidateInstallRequestConfinesLocalIPAPathToUploadDir covers:

  • Apple ID upload path: accepted;
  • Apple ID HTTP(S) URL: accepted;
  • Apple ID installed-app path: rejected;
  • Apple ID path outside the data directory: rejected;
  • symlink in tmp resolving to an installed app: rejected;
  • empty Apple ID path: rejected;
  • external-signing upload path: accepted;
  • external-signing installed-app path: rejected.

The installed-app/outside-path cases fail on current master.

Scope

Two files, one commit, based directly on upstream master at 48cb0f52cce0a5d2cb3383139806a7eb8c8756a1. No database, frontend, signing-engine or API-format changes.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@bitxeno
bitxeno merged commit 6270e7f into bitxeno:master Oct 7, 2026
bitxeno added a commit that referenced this pull request Oct 8, 2026
* test(install): resolve the upload path before comparing it

validateInstallRequest now stores the symlink-free path, which differs
from the temporary directory path on macOS (/var vs /private/var), so
the two accepted-path cases of the upload confinement test failed there.
Compare against filepath.EvalSymlinks of the upload file, the same
adjustment the older validate test already makes.

* feat(install): ask which certificate to revoke at the account limit

A free Apple ID allows only a few signing certificates, shared by every
sideloading tool on the account. The pinned signing engine used to
create one anyway and silently revoke an existing certificate to make
room, breaking apps other tools had installed (issue #195). The engine
now stops with a [certificate_reset_required] marker instead, and this
change closes the loop in the UI:

- An Apple ID install whose engine reports the marker keeps the staged
  IPA and opens a dialog listing the account's live certificates; the
  user picks one or cancels. Cancelling reports the plain failure, so
  nothing is ever revoked without a named choice.
- Confirming resends the exact install request snapshotted before the
  attempt, with revoke_certificate_serial set. The serial is validated
  as a hex string and passed as one --revoke-certificate argument; the
  engine applies it only while its account still lists that
  certificate. The staged upload file is kept for the retry and swept
  after 24 hours like any other abandoned upload.
- Automatic refreshes never authorize a revocation: they keep failing
  with the marker until the app is reinstalled from the install page.
- The rows of TestValidateInstallRequest that expected an Apple ID
  install to take any local path are confined to the upload directory
  like #196 requires.

Requires the PlumeImpactor fork commits 2500209..6ef63e8 (unreleased);
bump the Docker pin when this ships. Until then the installed engine
still revokes silently and the dialog simply never opens.

* fix(refresh): report the certificate limit instead of failing vaguely

An automatic refresh has no user to ask, so with the engine no longer
revoking on its own it stops when the Apple ID account holds as many
certificates as Apple allows. Classify that stop as the new
RefreshedErrorCertificateLimit (5) instead of the catch-all other
error: TryStart matches the [certificate_reset_required] engine marker
before any other classification, and the home page explains the badge
as "nothing was installed or revoked; choose a certificate on the
install page". The app row keeps its previous refresh state; the fix is
a manual reinstall, which offers the certificate dialog (previous
commit).

* chore(docker): bump PlumeImpactor to v2.2.3-patch.8

v2.2.3-patch.8 carries the certificate work the install page and the
refresh classification depend on: certificates are reused by private
key match regardless of machine name, and nothing is revoked unless a
serial was authorized with --revoke-certificate; a run that would need
to revoke stops with [certificate_reset_required] instead, which the
previous two commits detect and present.

The published plumesign binaries for x86_64 and aarch64 were checked to
contain the flag, the marker and the new error text before this bump.
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

⌂ 换网址