Repository navigation
fix(security): refuse --no-config under an agent session and on serve, acp and mcp - #858
Merged
Merged
Conversation
…, acp and mcp (#855) --no-config made the project and user configs unread, so the owner's sandbox mode, [sandbox.consumers], secret release and approval lists fell back to their defaults for a child of an agent session. Unlike --sandbox and --no-sandbox it was accepted under TOLE_UNDER_SESSION / a child agent, and on the unattended faces. It is now refused under an agent session and for serve, acp and mcp, with a message naming the reason; an owner at a terminal keeps it. The refusals of those faces for a config value they cannot honor no longer suggest the flag they now refuse.
…-under-session # Conflicts: # CHANGELOG.md
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
This was referenced Nov 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
--no-configis refused under an agent session (TOLE_UNDER_SESSIONset or child depth >= 1, the marker--sandbox/--no-sandboxalready use) and fortole serve,tole acpandtole mcp, with an error naming the reason. An owner at a terminal keeps it.Closes #855
Why
--no-configmakes the project and user configNone, so the owner's sandbox mode,[sandbox.consumers](run_command, job_start, verify), secret release,[sensitive_files],[delegation], hooks, profiles and allow/trust lists all fall back to defaults.--sandbox/--no-sandboxare refused under a session (#684/#750);--no-configwas not. A sandboxed command cannot reach this (check_session_argvstopsrun_commandrunning tole), but anything that starts tole unsandboxed and inherits the marker (anagent_startor delegated child, a job) could runtole --no-config ...and drop the owner's policy.A config whose parse fails is NOT a fail-open:
load_user_config/load_project_configreturn the error andmainexits (?);sandbox.policy()andconsumers()are validated at load, so the.ok()inmain.rscannot swallow a bad value.Changes
crates/tole-cli/src/no_config_guard.rs(new, small, sosandbox_flags.rsis untouched):check(given, ctx);Context { under_session, unattended_command }.main.rs: call it right after argument parsing, before the review-gate env, config loading or any command; unattended class reusessandbox_flag_class(..).0(serve, acp, mcp). The serve/acp/mcp refusals of a config value they cannot honor used to say "use --no-config"; they now say to remove the key (refuse_unattended),missionkeeps the old hint.tests/layering.rs(new face module), CHANGELOG,docs/sandbox-design.md6.2,--no-confighelp text.Config-dropping escape hatches (verified in code):
--no-config--config <path>[sandbox], consumers, secrets widening, delegation, hooks routes, profileson_pretool/posttool/turnend,allow,trust,mcp_server) andplan_mode = falselike a flag (reported, not changed)CODECORA_HOME(other, relative, orHOMEunset)--on-pretool,--allow,--trust,TOLE_TRUST, ...-c key=value,--no-user-config,TOLE_CONFIGGatePolicy::Skipcommands (config,cron,hook,sandbox,approvals,skills, ...)Callers / impact (cora is absent; grep, verified by hand):
cli.no_configis read only inmain.rs(project and user config loading, the new guard). Tests that pass--no-config:config_sensitive.rs,config_apply.rs,config_check.rs; none uses a session marker or serve/acp/mcp except the updatedconfig_sensitive.rshelper (serve/acp/mcp now expect the edit-the-config hint and the guard refusal). Hint text consumers:main_gate_tests.rs,config_apply.rs,config_sensitive.rs.config_apply.rsunsupported_keysstill says "use --no-config" (feature-missing key; shared by all faces, left as is).Testing
tests/no_config_guard_e2e.rs: refused underTOLE_UNDER_SESSIONandTOLE_AGENT_DEPTH, refused beforerun, refused for serve/acp (shell-tools) and mcp (shell-tools+mcp); control: same commands without the flag or without the marker are not refused. Unit tests inno_config_guard(hand-built context: attended owner keeps the flag; session and unattended refused). The harness has no pty, so the attended case is the unit test.check(false, ..)): 4 of the 5 e2e tests fail (session marker and depth, run, serve/acp, mcp; the control passes); restored, all pass.cargo fmt --all --check;cargo clippy --workspace --all-targets --all-features -- -D warnings;cargo clippy -p tole-core -p tole-cli -p tole-tui --no-default-features --all-targets -- -D warnings;cargo test -p tole-cliwith default features,--no-default-features, and--no-default-features --features shell-tools(no mcp): all green; layering test updated.scripts/review-local.shcould not run (cora not on PATH). Agent adversarial review ofgit diff origin/develop...HEAD: the guard sits before every config read; the remaining paths to an unsandboxed tole without the owner's config are out of this PR and listed below.Not fixed, for a decision:
TOLE_UNDER_SESSIONandTOLE_AGENT_DEPTH(an unsandboxed hook/cron script) is not covered, like every 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 guard. Proposal: also refuse--no-configwithout a terminal when the user config sets[sandbox] modeother than off or any consumer (same rule as--no-sandbox), reading the user file only to decide.CODECORA_HOMEelsewhere /HOMEunset: silent no user config. Proposal: warn at startup when the data dir is not the default andTOLE_UNDER_SESSIONis set; and usetry_exists()inload_user_configso an unreadable path fails closed (risky inside the command sandbox, where the data dir is masked).--config(--on-pretool,--allow,--trust): proposal: pin user-layer policy keys so a flag can only narrow them under a session.-ssessions dir inside the workspace but outside.toleis writable by a sandboxed command, which undermines the append-only claim for that setup. Proposal: refuse (or protect read-only) a sessions dir that is inside the workspace when the consumers are on.