Skip to content

security: --no-config (and CODECORA_HOME) drop the owner's sandbox and approval policy for a child of an agent session #855

Closed

Description

@ajianaz

What

tole --no-config ... makes the project and the user config None, so cfg is None in main.rs and the owner's user config is never read: [sandbox] mode, [sandbox.consumers] (run_command, job_start, verify), the secret release policy ([secrets]), [sensitive_files], [delegation], [hooks], profiles, the config allow/trust lists and the pre/post-tool hooks all fall back to their defaults. Unlike --sandbox / --no-sandbox (refused under an agent session by sandbox_flags::apply, #684/#750), --no-config is accepted whatever the session marker says, and on tole serve, tole acp and tole mcp.

A different CODECORA_HOME (or an unresolvable one: unset HOME, a relative path) has the same effect, because the user config path comes from it.

Why it matters

A sandboxed command cannot use this: check_session_argv keeps run_command from running the tole binary. But anything that starts tole unsandboxed (a hook, a cron script, an agent_start or delegated child, an MCP server running unsandboxed) can run tole --no-config ... and get a tole with no sandbox, no consumers, no release policy and no approval allowlist, or a child agent session that has dropped the owner's policy.

Scope of this issue (the clearly-right part)

Refuse --no-config under an agent session (TOLE_UNDER_SESSION set or child depth >= 1, the same marker as --sandbox/--no-sandbox) and on the unattended faces (serve, acp, mcp), with an error naming the reason. An owner at a terminal keeps it (it is a debugging flag).

Out of scope here, reported in the PR for a decision: the marker is an environment variable, so a script that strips it is not covered (same as the other #684 guards); the non-tty case; list keys that a flag/env/--config replaces (--on-pretool, --allow, --trust, ...); the sessions dir (-s) inside the workspace.

Acceptance

  • --no-config under TOLE_UNDER_SESSION / TOLE_AGENT_DEPTH and for serve/acp/mcp exits non-zero with a clear message (real-binary test).
  • Attended (no marker) --no-config is unchanged.
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions