mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
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:
1 parent
92689b6b7b
commit
17801b4206
12 files changed
+690
-388
No files matched your search
@@ -256,9 +256,6 @@ pub struct ConfigLayerStack {
|
||||
/// `None` means the loader did not check for stack-level warnings, while
|
||||
/// `Some(vec![])` means it checked and found nothing to report.
|
||||
startup_warnings: Option<Vec<String>>,
|
||||
|
||||
/// Project root resolved from the non-project config layers.
|
||||
project_root: Option<AbsolutePathBuf>,
|
||||
}
|
||||
|
||||
impl ConfigLayerStack {
|
||||
@@ -275,21 +272,9 @@ impl ConfigLayerStack {
|
||||
requirements_toml,
|
||||
ignore_user_and_project_exec_policy_rules: false,
|
||||
startup_warnings: None,
|
||||
project_root: None,
|
||||
})
|
||||
}
|
||||
|
||||
/// Records the project root resolved while loading this stack.
|
||||
pub fn with_project_root(mut self, project_root: Option<AbsolutePathBuf>) -> Self {
|
||||
self.project_root = project_root;
|
||||
self
|
||||
}
|
||||
|
||||
/// Returns the project root resolved from the non-project layers.
|
||||
pub fn project_root(&self) -> Option<&AbsolutePathBuf> {
|
||||
self.project_root.as_ref()
|
||||
}
|
||||
|
||||
pub fn with_user_and_project_exec_policy_rules_ignored(
|
||||
mut self,
|
||||
ignore_user_and_project_exec_policy_rules: bool,
|
||||
@@ -416,7 +401,6 @@ impl ConfigLayerStack {
|
||||
ignore_user_and_project_exec_policy_rules: self
|
||||
.ignore_user_and_project_exec_policy_rules,
|
||||
startup_warnings: self.startup_warnings.clone(),
|
||||
project_root: self.project_root.clone(),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -451,7 +435,6 @@ impl ConfigLayerStack {
|
||||
ignore_user_and_project_exec_policy_rules: self
|
||||
.ignore_user_and_project_exec_policy_rules,
|
||||
startup_warnings: self.startup_warnings.clone(),
|
||||
project_root: self.project_root.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user