Repository navigation
Description
Found in the #594 security audit. Severity: high. Status: confirmed (reproduced with the real binary).
Affected code
crates/tole-cli/src/mission.rs:206run_verify:Command::new("sh").arg("-c").arg(cmd)with noscrub_env_forcall. Called atmission.rs:439after every completion marker, with no approval.- Related:
on_turnendstop gates (crates/tole-core/src/hooks.rs:63/91) are scrubbed as consumerhook, which by default KEEPSGITHUB_TOKEN(secret_release.rsDEFAULT_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.txtBoth 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]likerun_command). - Make
on_turnendgates a separate consumer fromhook(or drophookfrom theGITHUB_TOKENdefault), 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 writesprintenvmust not contain a secret-named variable.
Activity