Skip to content

security(trust): owner-only trust records can be written by the agent (tole CLI from run_command, file tools when the workspace holds the data dir) #684

Closed

Description

@ajianaz

Found in the #594 security audit. Severity: medium. Status: plausible (code reading; the CLI paths are plain commands).

Affected code

  • Records that mean "the owner did this": created_by = cli / enabled_by = cli (crates/tole-cli/src/cron/trust.rs:77), plugin approvals (plugin_cmd.rs consent: --hash approves without a terminal), skill approvals (tole skills approve), project-config trust (config_trust.rs), the delegation log (delegate.rs:74, "outside every workspace").
  • run_command / job_start only refuse the tole binary in child-agent mode (agents.rs:65 check_child_agent_argv); a root session can run tole cron create --script ..., tole cron resume <id>, tole plugin approve X --hash H, tole config trust.
  • File tools (file_tools.rs jailed) only jail to the workspace. When the workspace contains $CODECORA_HOME (tole started in ~), write_file can edit ~/.codecora/tole/cron/*.jsonl, plugins.lock, skill-approvals.json, trusted-configs.json and the user config.toml. Only cron agent runs check this (ledger_in_workdir).

Problem

#581's rule "an agent job runs only after a human enabled it" and #599/#591's "only the owner approves" are enforced by WHO wrote a record, but any same-uid process the agent starts can write it through the official CLI, and the file tools can write it directly in the home-workspace case. One approved command turns a session into persistent unattended execution with owner authority.

Scenario

In a mission with --allow run_command (or after the owner approves a plausible tole cron resume job-...), an injected instruction runs tole cron create '@every 10m' --script 'sh -c ...': saved created_by = cli, a script job with owner authority, running long after the session. Or, with tole started in ~, write_file .codecora/tole/plugins.lock approves an arbitrary server.

Suggested fix

  • Refuse, in every session (not only child agents), a run_command/job_start argv whose program resolves to the running tole executable, and set a marker env (TOLE_AGENT_DEPTH already exists) that makes owner-only subcommands (cron create/resume/edit, plugin approve, skills approve, config trust) refuse to write when invoked under a session. This is defense in depth, not a boundary (a copied binary or Python can still write the files), so also:
  • Refuse a file-tool jail (and warn at startup) when the workspace contains the tole data dir, for every session kind, as ledger_in_workdir does for cron.
  • Longer term (feat(plugins): sandbox wrapper for third-party stdio servers, lazy start, tool retrieval by meaning #601): run model commands in a sandbox that cannot write the data dir.

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