Skip to content

feat(cli): config trust store and tole config trust/untrust (#208, part 2 of 3) - #343

Merged
ajianaz merged 1 commit into
developfrom
feat/config-trust-store
Oct 9, 2026
Merged

ajianaz merged 1 commit into
developfrom
feat/config-trust-store

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

What

Trust machinery for the project config (#208 part 2 of 3): a content-bound trust store, a fail-closed gate function (library only), tole config trust|untrust, and a trust: line in tole config check.

Why

.tole/config.toml comes from a cloned repo and is untrusted. Before part 3 applies it to sessions, approval must be content-bound, stored outside the repo, shown terminal-safely and fail closed without a TTY.

Changes

  • config_trust.rs: store at $CODECORA_HOME/tole/trusted-configs.json (v1, atomic write, 0600/0700, corrupt or unsupported store is a hard error, 64 KiB cap, no cwd fallback), gate() with injected ConfigTrustIo, sanitize (escapes control/bidi/zero-width chars), hand-rolled LCS line diff (summary above 2000 lines), StdIo (stderr, interactive = stdin and stderr are TTYs).
  • CLI: config trust [--config] [--yes], config untrust [--config]; config check prints the trust line (exit code unchanged).
  • config::read_source made pub (was private read_bounded).
  • README, threat-model subsection, CHANGELOG. Gate is NOT called from startup; no other command or help text changes.

Testing

Unit tests (store, byte-identical trust, gate matrix, escaping, diff, commands) plus e2e tests with the real binary and a child-only CODECORA_HOME. Mutation-checked: length-only compare, no escaping and dropped non-interactive refusal each fail tests. fmt, clippy -D warnings, workspace tests, bare-profile checks pass; cora review --staged clean.

Part of #208

🤖 Generated with Claude Code

…rust (#208, part 2 of 3)

Trust store at $CODECORA_HOME/tole/trusted-configs.json (atomic 0600 writes,
corrupt store is a hard error), a fail-closed gate function with a
terminal-safe review prompt and line diff, tole config trust|untrust and a
trust line in tole config check. Not wired to startup; config is still not
applied to sessions.

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

@ajianaz
ajianaz merged commit 69968d9 into develop Oct 9, 2026
17 checks passed
@ajianaz
ajianaz deleted the feat/config-trust-store branch October 9, 2026 06:43
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.

1 participant