agent-device: is install_from_source kind:path an arbitrary daemon-host file read over /rpc?
In agent-device (commits
848c6ea733/d44df9b588), the shared remote daemon'sinstall_from_sourceacceptedsource.kind: "path"with only a non-empty check, letting an authenticated/rpccaller read any daemon-user-readable file. Local console/CLI flows that build path sources were not affected. What is the correct fix, and has it landed?Originally asked on GitHub: https://github.com/callstack/agent-device/issues/2097
3 answers
Status: the issue is closed as COMPLETED, but the thread itself shows no fix commit or PR — the maintainer triage directed the fix, so verify against current main.
Root cause: on the HTTP surface,
parseInstallSource(src/daemon/server/http-server.ts) returned{ kind: 'path', path }after only a non-empty check, andmaterializeLocalSource(src/platforms/install-source.ts) returnedexpandUserHomePath(source.path)with no confinement. Theurlkind had hygiene (credentials rejected, blocked hostnames, DNS-resolved non-public-address rejection, redirect caps, HTTPS-downgrade blocks); thepathkind had none. Any authenticated caller reaching/rpccould name a daemon-user-readable path and have its bytes flow back through the install pipeline.The accepted fix direction (comment 2): reject
source.kind = "path"unconditionally at the HTTP boundary withINVALID_ARGS, leave the trusted local callers unchanged (admin.tsanddiff-screenshot.tsbuild path sources locally and never cross that boundary), and retain local-path regression coverage. Do not add an opt-inallowHostPathInstall/ allowlist-root config surface without separate approval — the reporter's proposed opt-in design was explicitly deferred.Security note: before this fix, anyone with a valid token who could reach
/rpccould read arbitrary daemon-user-readable files; keep daemon tokens scoped to trusted tenants.Did this work for you?What @thymikee tried on GitHub (Outcome unclear)
Maintainer triage against current main d44df9b588 confirmed the issue and directed the accepted fix: reject source.kind = "path" unconditionally at the HTTP boundary (INVALID_ARGS), do not add an opt-in host-path config surface without separate approval, and keep local-path regression coverage. No commit or PR is referenced in the thread, so the landing of the fix is not confirmed here.
Source: https://github.com/callstack/agent-device/issues/2097#issuecomment-5441380068 (opens external site)
Did this work for you?What a GitHub user tried on GitHub (Outcome unclear)
Reporter demonstrated the vulnerability at commit 848c6ea733 by tracing the
kind: "path"branch inparseInstallSource(non-empty check only) andmaterializeLocalSource(expandUserHomePath, no confinement), and proposed gating path installs at the HTTP boundary plus an allowlist root behind an opt-in flag.Source: https://github.com/callstack/agent-device/issues/2097 (opens external site)
Did this work for you?
Related questions
- agent-device open <package> fails on Android apps with multiple launcher activities
- agent-device web screenshot: how to capture the full page instead of the viewport?
- Why does agent-device take ~6.7s to resolve an Apple device, and can usbmuxd replace devicectl/xctrace?
- Why does agent-device iOS text-entry fail with TEXT_INPUT_COMMIT_NOT_OBSERVED intermittently on the simulator?
- agent-device daemon: client tenant trusted when auth hook doesn't attest tenantId?