Skip to content

security(mission): --verify runs agent-written code with tole's full, unscrubbed environment #676

Closed

Description

@ajianaz

Found in the #594 security audit. Severity: high. Status: confirmed (reproduced with the real binary).

Affected code

  • crates/tole-cli/src/mission.rs:206 run_verify: Command::new("sh").arg("-c").arg(cmd) with no scrub_env_for call. Called at mission.rs:439 after every completion marker, with no approval.
  • Related: on_turnend stop gates (crates/tole-core/src/hooks.rs:63/91) are scrubbed as consumer hook, which by default KEEPS GITHUB_TOKEN (secret_release.rs DEFAULT_RELEASE), and they typically run agent-written code too (cargo test).

Problem

The verify command is the owner's (--verify or mission.verify from a trusted config), but what it executes is usually code the agent just wrote: cargo test runs build.rs and tests, npm test runs package scripts. So an agent that may only WRITE files (no run_command) gets code execution with every secret tole holds: provider key, GITHUB_TOKEN, TOLE_SERVE_TOKEN, webhook keys. This defeats #598's "model commands get no secrets" in the one place that needs no approval.

Scenario

tole mission --allow write_file --verify "cargo test" "fix the parser". A prompt injection in an issue body or fetched page makes the model add a test that posts std::env::vars() to an external host. The mission's own verify step runs it, unattended, with the full environment.

Reproduction

Mock provider on 127.0.0.1 that answers done\nMISSION_COMPLETE, then:

TOLE_BASE_URL=http://127.0.0.1:18793/v1 TOLE_MODEL=mock TOLE_STREAM=0 \
TOLE_API_KEY=sk-audit-provider-key-0123456789 GITHUB_TOKEN=ghp_auditGithubToken0123456789 \
tole mission --yes --no-auto-mcp --verify "printenv > verify_env.txt" "do nothing"
grep -E 'TOLE_API_KEY|GITHUB_TOKEN' verify_env.txt

Both values are printed (status: complete, verify failures: 0).

Suggested fix

  • Scrub the verify child with a dedicated consumer (verify, nothing by default; grantable via [secrets] like run_command).
  • Make on_turnend gates a separate consumer from hook (or drop hook from the GITHUB_TOKEN default), since stop gates execute workspace code.
  • Note this alone is not enough while security(secrets): any child process reads tole's full environment through /proc/<ppid>/environ #675 (/proc/<ppid>/environ) is open: fix both.
  • Regression test in tests/mission_e2e.rs: a verify command that writes printenv must not contain a secret-named variable.

Activity

  1. added
    bug
    on Nov 13, 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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions