Skip to content

Plumb the exec request's stdin through sandbox.ExecContext so agent prompts leave the shell's argv #6983

Description

@waynesun09

What happened

sandbox.ExecContext / ExecStreamReader run openshell sandbox exec … -- sh -c <command> and wire no stdin at all, so every caller that needs to hand text to a process in the sandbox builds it into the command string:

The text never reaches the agent CLI's own argv, which is what those comments were guarding against, but it is in the intermediate sh -c argv: readable in /proc inside the sandbox by the sandbox user, and included in OpenShell's host-side command preview (first ~120 chars). The text is attacker-influenced (PR bodies, comments, commit messages, validation failures), so it is worth keeping out of both.

Inside the sandbox the reader is the agent itself, which is the intended recipient, so this is not a privilege boundary today. It becomes one as soon as a second, less-trusted process shares a sandbox, and the log preview is a disclosure regardless.

Proposed change

Add an optional stdin payload to the sandbox exec helpers (the OpenShell exec request already carries a stdin field) and use it for:

  • the codex prompt (- sentinel already reads stdin)
  • the steer mailbox write, which becomes cat >> <mailbox> with the line on stdin

Then the "never argv" claim in ADR 0101 and in the codex runtime comments is true as written.

Validation criteria

ps//proc inside the sandbox during a run shows no prompt or steer text in any command line, and an OpenShell command preview for those execs contains none either.

Refs #6959, ADR 0101.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    component/runnerAgent runner behavior and lifecyclecomponent/sandboxOpenShell sandbox environmentpriority/mediumNormal priority, plan for next cyclesecuritySecurity threat model and related concernstriagedTriaged but awaiting human prioritization

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions