Repository navigation
fix(mobile): keep a phone's managed server update to Update anyway - #52610
Conversation
A paired phone reached managedServer.update through the shared handler, so it could pass the desktop-only force and endInProcessTerminals options and end the terminals a server runs. The host now refuses both for a mobile-scope caller; the phone's Update anyway (pastLiveTerminals) and the desktop and CLI paths are unchanged.
[Low impact] The PR appears safe to merge; the restriction preserves the phone's normal update flow and desktop force options. SummaryRestricts
Reviews (2) · Last reviewed commit: "fix(mobile): keep a phone's managed serv..." · Reviewed by Greptile |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
ELI5
A paired phone could ask the computer to force-update a server it installed over SSH, in a way that could end terminals running on that server. Only the computer and the CLI should be able to do that. Now the computer turns those requests away when they come from a phone, and the phone's normal "Update anyway" still works.
What Changed
managedServer.updatenow refusesforceandendInProcessTerminalsfrom a caller with phone scope, with the errormanaged_server_update_option_not_allowed. Phone scope is assigned by the transport from the paired device's record, so request params can't fake it.pastLiveTerminals).Why
#52332 let phones call
managedServer.updateso they could update SSH-managed servers. The phone allowlist gates which methods a phone may call, not which options. The shared handler then trusted every option from any caller that passed thehost-adminpermission. So a phone-scope request could addendInProcessTerminalsor a bareforce, which skip the confirmed-incumbent check and can end terminals the server runs itself. The phone UI never sends them, but the host has to enforce that.The check sits in the handler, where the caller's transport-assigned scope and the options meet. That is the one place every phone path reaches:
Dropping the options instead of refusing them would quietly turn a forced request into a normal one. A clear refusal is easier to see and to reason about.
Linked Issue
STA-19882 (release-blocking, from the release scan of #52332).
Visual Proof
N/A: no visible change. The phone never sent these options, and its Update and Update anyway flow is the same. The proof is the live RPC run below.
Testing
Live run on macOS. The setup:
Results:
{endInProcessTerminals: true},{force: true}and{force: true, endInProcessTerminals: true}all returnedmanaged_server_update_option_not_allowed. The server stayed on0.1.0+1afd687989b3, and its terminal (sleep 100000, pid 13292) kept running.deferred(orcad_update_terminals_running). Update anyway withpastLiveTerminals: {incumbentVersion: '0.1.0+1afd687989b3'}returnedupdated. The server then ran0.1.0+c445e30ea2e1, and the same terminal was still running.managedServer.update {force: true, endInProcessTerminals: true}went through to the actions and returnedalready-current.Automated:
managed-server.test.tscalls the real handler and params schema, with only the update action replaced through the real registry. PhoneforceandendInProcessTerminalsare refused, phonepastLiveTerminalspasses, and owner and runtime-paired scopes keep both options. It fails on main.pnpm check:changedpasses.Traced by hand: the direct, relay and delegated phone paths all reach this handler with phone scope. The other managed-server methods are not allowed for phones, IPC is owner-only, and no shipped phone ever sent these options.
Performance
None, because this adds one constant-time scope check per
managedServer.updatecall, before any work starts.Risk
Level: Low
force. No shipped phone sends it; the phone only sendsselectorandpastLiveTerminals.AI Disclosure
Review
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)