Repository navigation
fix(daemon): exec children get a minimal environment; docs say what an agent token can do - #891
Merged
Merged
Conversation
Contributor
Author
Review (maintainer's agent, round 1)No blocking findings.
Notes, no change needed:
|
This was referenced Oct 23, 2026
V3RON
marked this pull request as ready for review
October 26, 2026 09:46
V3RON
force-pushed
the
security/exec-env
branch
from
October 26, 2026 10:29
e66f126 to
5310909
Compare
…n agent token can do (#891)
V3RON
force-pushed
the
security/exec-env
branch
from
October 26, 2026 14:25
5310909 to
42a5b2f
Compare
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.
Summary
device.execlets an agent token run host tools such asxcrun simctl spawnas the daemon's user. That is by design. Two things were not: the exec child got the daemon's whole environment, so any secret in it was readable by every lease holder, and the docs never said an agent token equals code execution on the worker.Now the child starts from a short allowlist of the daemon's variables, plus the driver's
env, minus itsunsetEnv. The website says what an agent token can do.Changes
src/daemon/exec-env.ts(new):execBaseEnvironment(env)keepsPATH,HOME,TMPDIR, user and shell keys,LANG,LC_*,TERM,DEVELOPER_DIR, theANDROID_*homes andJAVA_HOME.main.tspasses it as the dispatcher'sexecEnv.remote-agents.mdxandgateway/access-control.mdxsay an agent token is like shell access and list the variables a command gets.src/daemon/AGENTS.md,docs/internal/flows/device-exec.md.Tests
src/daemon/exec-env.test.ts: kept and dropped keys, look-alikes included.src/daemon/main.test.ts: a plantedAWS_SECRET_ACCESS_KEYdoes not reach adevice.execchild;LC_CTYPE,PATHand the driver's env do.Assumptions
main.ts), so the proof goes throughstartDaemon, not theDispatcheralone.ANDROID_ADB_SERVER_PORTthemselves, and adb-server or emulator keys are read by processes the daemon starts with its own environment.Review
Spec review: skipped. Code review: 0 blocking, 0 fixed, 0 notes. Claims review: skipped.
Rounds: 1. Tokens: n/a.
One combined review by the maintainer's agent on 2026-10-22 (comment below); no blocking findings.
Rebased onto
maine1f2f43 on 2026-10-26 as one commit. Conflicts:flows/device-exec.mdkeeps main's device-filling line (ADR 0047) and this PR's env step.remote-agents.mdxkeeps this PR's paragraph on what a command gets, and main's newer bullets (Simlock fills in the device), replacing this PR's older "name your device" bullets.Written by an agent.