Prompt before trusting local project directories (#36960)

## Why

Trusting a directory enables project-local config, hooks, and exec policies, which can increase exposure to prompt injection. Require an explicit decision instead of automatically trusting projects whose trust level is unset.

## What changed

- Add a directory-trust step to TUI onboarding, with options to trust and continue or quit.
- Apply trust to the Git repository root when starting from a subdirectory, persist the decision, and reload config before continuing.
- Keep the prompt active and show the config error when trust cannot be persisted. Skip the prompt for remote workspaces and projects with an explicit trust level.

## Testing

- Cover trust-screen rendering, keyboard selection, persistence failures, and prompt visibility for explicit trust and Windows sandbox states.

GitOrigin-RevId: 850e6f54aec84d584cd161348ecdb1da89aaabd4
This commit is contained in:
Eric Traut authored and copyberry committed 2026-08-04 19:48:21 +00:00
1 parent 92689b6b7b
commit 17801b4206
12 files changed
+690 -388

No files matched your search

-5
View File
@@ -159,7 +159,6 @@ async fn apply_role_preserves_unspecified_keys() {
TomlValue::String("base-model".to_string()),
)])
.await;
let project_root = config.config_layer_stack.project_root().cloned();
config.codex_linux_sandbox_exe = Some(PathBuf::from("/tmp/codex-linux-sandbox"));
config.main_execve_wrapper_exe = Some(PathBuf::from("/tmp/codex-execve-wrapper"));
let role_path = write_role_config(
@@ -188,10 +187,6 @@ async fn apply_role_preserves_unspecified_keys() {
(config.model.as_deref(), config.model_reasoning_effort),
(Some("spawn-model"), Some(ReasoningEffort::Low)),
);
assert_eq!(
config.config_layer_stack.project_root(),
project_root.as_ref()
);
assert_eq!(
config.codex_linux_sandbox_exe,
Some(PathBuf::from("/tmp/codex-linux-sandbox"))