Skip to content

feat(cli): apply security-sensitive project config keys (#208, part 3b) - #346

Merged
ajianaz merged 2 commits into
developfrom
feat/config-apply-sensitive
Oct 9, 2026
Merged

ajianaz merged 2 commits into
developfrom
feat/config-apply-sensitive

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

What

Part 3b of 3 (final) of the project config .tole/config.toml: applies the security-sensitive keys trust, allow, mcp_server, on_pretool/on_posttool/on_turnend, skill, plan_mode, no_auto_mcp, no_skills and [mission] verify/verify_timeout after the trust gate, finishes the docs, and closes the feature.

Why

Parts #342/#343/#345 validated, gated and applied the low-risk keys. The remaining keys are what make a per-project config useful (allow, trust, hooks, MCP servers) and what make it dangerous, so they land last, on top of the trust gate, with explicit rules for lists, booleans and the faces that refuse flags.

Changes

  • config_apply.rs: resolve_list (highest non-empty layer replaces the whole list; flag > env > config, TOLE_TRUST is the env layer for trust), resolve_bool (flag || config, flags can only turn on), Settings::resolve now resolves every key; unsupported_keys (loud error for mcp_server/no_auto_mcp without the mcp feature, hooks/memory without shell-tools); config check shows effective value + source for every key (lists show the effective list, booleans (config)/(flag) plus the only-on note).
  • main.rs: host settings, trust expansion, per-subcommand --allow fallback, mission verify/timeout all come from the effective values; every face refusal (serve/acp/mcp/mission: hooks, turn-end, --plan-mode, --memory, --skill, --no-skills, --mcp-server) now checks the effective values and, for a config-sourced value, appends use --no-config to ignore the project config. check_client_session_flags is no longer mcp-gated so a config skill/no_skills is refused in every profile. --verify-timeout is Option<u64> (the [default: 300] stays in the help text, --help is byte-identical).
  • Docs: README Configuration section (all keys, precedence, list replace-wholesale, boolean only-on, --no-config, face refusals, trust flow), docs/threat-model.md (sensitive keys only after trust, Destructive never allowlistable via config, faces refuse config hooks, residual: a trusted config is trusted), docs/epics.md entry (unreleased), CHANGELOG bullet.
  • Tests: the two 3a tests that asserted "3b keys not applied" (h_security_sensitive_keys_are_not_applied_yet in tests/config_apply.rs, and the unit pair security_keys_do_not_change_any_resolved_setting / check_marks_every_security_key_not_applied... in config_apply_tests.rs) are flipped to assert they ARE applied.

Closes #208

Testing

  • Pure matrices for resolve_list and the boolean rule; per-key resolution tests (flag/env/config/default).
  • New tests/config_sensitive.rs (real binary, mock provider, CODECORA_HOME on the child only): plan_mode (tool list on the wire), allow, trust, hooks (deny script invoked), mcp_server (spawn attempt, flag replaces list), no_auto_mcp (fake cora), skill/no_skills, mission verify + timeout, face refusals with hint (serve/acp/mcp/mission), flag-sourced refusal has no hint, --no-config drops everything, Destructive never allowed via config allow/trust (file survives) plus the approver/registry walls.
  • Verified failing against deliberate weakenings (apply hooks on serve, disable the Destructive guard, merge instead of replace, overridable boolean), each restored.
  • cargo fmt, clippy --workspace --all-targets -D warnings, cargo test --workspace, the --no-default-features / shell-tools / tole-core checks; e2e also run in the bare and no-mcp profiles; cora review --staged clean.

🤖 Generated with Claude Code

Applies trust, allow, mcp_server, on_pretool/on_posttool/on_turnend, skill,
plan_mode, no_auto_mcp, no_skills and [mission] verify/verify_timeout from
.tole/config.toml after the trust gate (single startup path).

- resolve_list: the highest non-empty layer replaces a whole list
  (flag > env > config); resolve_bool: flag || config (flags only turn on).
- Faces that refuse a flag (serve/acp/mcp/mission) refuse the config-sourced
  value with the same message plus a --no-config hint; the checks run on the
  effective values.
- Builds lacking the mcp / shell-tools feature reject the matching config
  keys loudly instead of ignoring them.
- config allow/trust feed the same approver as the flags; Destructive stays
  un-allowlistable (tested end to end).
- tole config check shows effective value + source for every key.
- README configuration section, threat model, epics and CHANGELOG updated.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

…ure-aware

In the no-mcp profile (CI job: shell-tools only) mcp_server is shown as
unsupported by the build and startup refuses it first, so the tests must not
expect an effective value / the mission plan-mode refusal for gated-off keys.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

project config: .tole/config.toml — per-directory defaults for flags

1 participant