Skip to content

security: tole cron run and tole cron tick run agents and scripts without the owner's user config applied #863

Closed

Description

@ajianaz

Version

develop at 584d63a. Item 5 of the not-fixed list of #858 (follow-up of #855).

Operating system

Any (the sandbox parts: Linux).

What happened?

gate_policy classifies Command::Cron and Command::Hook (and config, sandbox, approvals, skills, ...) as GatePolicy::Skip (main.rs, gate_policy). For Skip, main.rs loads neither the project config nor the user config (let user_config = if policy == GatePolicy::Skip || cli.no_config { None }), so cfg = None and the startup block that applies the owner's policy runs with defaults:

  • tole_core::secret_release::set_release(default): the [secrets] narrowing or widening is not applied;
  • tole_core::sandbox::set_policy(None): [sandbox] mode is off, so third-party stdio MCP servers of a cron agent run are NOT sandboxed even when the owner set required;
  • tole_core::sandbox::command::set_consumers(default): [sandbox.consumers] is off (run_command, job_start, verify, turnend of a cron agent run);
  • tole_core::sensitive::set_extra(none): the owner's [sensitive_files] globs are not applied.

For most Skip commands that is right: they edit files and must work when the config is broken (tole config check, tole doctor diagnose it). But tole cron run <job> and tole cron tick EXECUTE jobs in this process: cron/agent.rs::run_agent builds a tool roster and runs a full agent turn (MCP servers, run_command, job_start), and cron/tick.rs::run_script spawns a script. The only places the cron code reads the user config itself are setup::user_config() (profiles, [cron] caps, model routing), never the sandbox, consumers, secret-release or sensitive-files keys. tole serve is not affected (it is NoPrompt, loads the config). The OS-cron path (crontab calling tole cron tick) is.

The owner who wrote [sandbox] mode = "required" and [sandbox.consumers] run_command = "required" therefore gets a sandboxed tole run and an unsandboxed cron agent.

Callers (grep): gate_policy has one caller (main.rs, startup); Command::Cron is dispatched to tole_cli::cron::cli; jobs run from CronAction::Run and CronAction::Tick (cron/mod.rs) via tick::run_claimed -> run_agent / run_script. Command::Hook (webhook route editing and hook test) runs no agent: no change needed.

What did you expect to happen?

A cron command that runs a job loads the USER config (never the project config: a job's workdir is not trusted to configure the host) and applies the same startup policy as tole run. The commands that only edit files keep skipping it.

Fix (clear, not a design trade-off; I will implement it unless told otherwise)

  • In main.rs, Cron { action: Run | Tick } (and nothing else of Skip) loads the user config like MayPrompt/NoPrompt do (load_user_config, no trust gate, user layer only) and takes the rest of the startup path with cfg. A broken user config makes these two subcommands fail closed instead of running with defaults (cron list, status, create, ... still skip it, so tole cron stays usable to repair things).
  • Tests: a real-binary e2e that a cron script job and an agent job under [sandbox.consumers]/[sandbox] mode = required with no bwrap are refused (and run when the config says off), a unit test of the new classification (which cron actions load the config), and the existing cron_* tests rerun. Each must fail without the fix.
  • Tests to rerun: main_gate_tests.rs, cron_* (crates/tole-cli/tests), config_check.rs, sandbox_cli.rs, layering.rs.
  • Docs: threat model and docs/sandbox-design.md (cron agent runs are covered by [sandbox] and [sandbox.consumers]; cron scripts are still not sandboxed: third slice of feat(sandbox): sandbox model-driven commands: remaining: cgroup limits (evaluated 2026-11-19, deferred: not cheap) #748), CHANGELOG.
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