Skip to content

fix(security): delete DynamicWorkflow and CodeMode, whose sandboxes let model-written code reach os and start processes #947

Closed

Description

@dan-petty

Problem

DynamicWorkflow (ai/harness/workflow.py:550-680) runs model-written Python in-process, and its sandbox does not contain it.

  • sandbox_env exposes the typing and asyncio modules, and the AST check blocks only imports and dunder attributes.
  • A probe on 2026-10-02 showed that model-written code can reach os and start processes:
    • typing.sys.modules['os'].getpid() returned the pid;
    • await asyncio.create_subprocess_exec('true') ran with exit 0.

No CLI command builds a DynamicWorkflow or a WorkflowAgent. Only tests/test_harness.py does. Both are exported from devops_cli.ai, devops_cli.ai.agents and devops_cli.ai.harness, so any caller could. The review session 20261001-224227 flagged the file with the wrong mechanism; the triage and the loop analysis confirmed the real one.

Acceptance criteria

  • DynamicWorkflow, WorkflowAgent and the sandbox helpers they alone use are deleted, with their exports and tests (pre-1.0, no shim). This is the roadmap's own rule: "If no production agent will attach these capabilities, delete them."
  • rg -n "DynamicWorkflow|WorkflowAgent|run_workflow" src tests docs prints nothing, or only an unrelated name.
  • Docs and knowledge-base pages that describe them are corrected.
  • uv run devops ci passes.

Key questions

  • Fix the sandbox instead? No (proposed). No production path uses it, and an in-process Python sandbox is not a boundary worth keeping. If one is needed later, it runs model code in the host sandbox (bwrap) that review criteria already use.

Scope extended (2026-10-02)

CodeMode (ai/harness/os_access.py) has the same hole. It runs model-written code with exec in-process and hands it the same typing and asyncio modules. A probe against the trimmed tree, run_code(code="typing.sys.modules['os'].getpid()"), returned the pid. No production code builds a CodeMode; it is only exported from devops_cli.ai, devops_cli.ai.agents and devops_cli.ai.harness.

Added scope:

  • Delete CodeMode, the helpers only it uses, its exports and its tests, with no shim.
  • OSAccess, MountDir and ToolSearch stay if production code uses them.
  • The architectural invariant asserts that no module in src/devops_cli calls the exec or eval builtin.

Activity

  1. added this to the v0.2.25 milestone on Oct 2, 2026
  2. added
    type/security
    scope/ai
    priority/p1-high
    on Oct 2, 2026
  3. changed the title [-]fix(security): delete DynamicWorkflow, whose sandbox lets model-written code reach os and start processes[/-] [+]fix(security): delete DynamicWorkflow and CodeMode, whose sandboxes let model-written code reach os and start processes[/+] on Oct 2, 2026
  4. dan-petty commented on Oct 2, 2026

    @dan-petty
    OwnerAuthor

    Closed by #964, merged into release/v0.2.25.

    GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by devops gh issues close-merged.

  5. added a commit that references this issue on Oct 3, 2026
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

    priority/p1-highscope/aitype/security

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions