feat(control): remote-control policy — gate high-risk actions from remote callers#114
Merged
Conversation
…mote callers
src/control/policy.ts: ControlPolicy { remoteControl (default true), remoteAdoptExternal (default false) }, persisted to ~/.lisa/control-policy.json, loopback-settable.
server: GET/POST /api/control/policy (POST is loopback-only); a denyRemote() gate on managed start/send/cancel/approve, pty start (+ resumeSessionId ⇒ adoptExternal), pty send/cancel/output/stream, and signal cancel. The Mac owner (loopback) is never gated.
Net effect: a phone (token) can see + control LISA's OWN agents by default, but cannot adopt the user's EXTERNAL sessions until the Mac owner opts in.
Verified: typecheck + build clean; 733 tests pass; live-checked the 403s from a non-loopback LAN IP.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Closes the security gap from #113's follow-ups: a phone holding a valid token could call every control endpoint, including adopting the user's real
claudesessions. This adds a second authorization axis — a Mac-side policy that gates high-risk control actions from remote (non-loopback) callers. The local user (loopback) is never gated.src/control/policy.ts—ControlPolicy:remoteControl(default true) — a remote may control LISA's own agents (managed/pty: start/send/cancel/approve). Lower-risk, LISA-owned.remoteAdoptExternal(default false) — a remote may adopt the user's external sessions (pty/startwithresumeSessionId, i.e.claude --resume). Touches a real transcript → off until the Mac owner opts in.Persisted to
~/.lisa/control-policy.json; tolerant of missing/corrupt files.How
GET /api/control/policy(any authed caller) reports it;POST /api/control/policysets it but only from localhost (like the API-key save).denyRemote(need)helper (loopback ⇒ allow; else consult policy) writes the 403 and short-circuits. Applied to: managedstart/send/cancel/approve; ptystart(→adoptExternalwhenresumeSessionIdis present, elsecontrol),send,cancel,output,stream; andsignalcancel (list stays open — it's telemetry).Verification
npm run typecheck+npm run buildclean; 733 tests / 732 pass / 1 skip / 0 fail (new: 5 policy unit tests).--host 0.0.0.0+ token):GET policy→{remoteControl:true, remoteAdoptExternal:false}POST policyfrom remote → 403; from loopback → 200remoteControl:false: managed/start from remote → 403Follow-ups (unchanged from #113)
Next in queue: roster de-dup (resume-adopt vs claude-code observer) + gated
/api/dispatch/statuslog tail; then the iOS-facing backend (pairing/devices/push) and PWA polish. The native SwiftUI app (ActivityKit/WidgetKit/APNs) will be scaffolded but can't be compiled/verified in this repo.🤖 Generated with Claude Code