fix: trust-gate project hooks and exec policies

This commit is contained in:
viyatb-oai
2026-03-26 18:06:27 -07:00
parent 81fa04783a
commit e0aaebaf16
9 changed files with 428 additions and 52 deletions
+5 -9
View File
@@ -439,16 +439,12 @@ fn emit_project_config_warnings(app_event_tx: &AppEventSender, config: &Config)
let ConfigLayerSource::Project { dot_codex_folder } = &layer.name else {
continue;
};
if layer.disabled_reason.is_none() {
let Some(disabled_reason) = &layer.disabled_reason else {
continue;
}
};
disabled_folders.push((
dot_codex_folder.as_path().display().to_string(),
layer
.disabled_reason
.as_ref()
.map(ToString::to_string)
.unwrap_or_else(|| "config.toml is disabled.".to_string()),
disabled_reason.clone(),
));
}
@@ -457,8 +453,8 @@ fn emit_project_config_warnings(app_event_tx: &AppEventSender, config: &Config)
}
let mut message = concat!(
"Project config.toml files are disabled in the following folders. ",
"Settings in those files are ignored, but skills and exec policies still load.\n",
"Project-local config, hooks, and exec policies are disabled in the following folders ",
"until the project is trusted, but skills still load.\n",
)
.to_string();
for (index, (folder, reason)) in disabled_folders.iter().enumerate() {
@@ -1,12 +1,13 @@
---
source: tui/src/onboarding/trust_directory.rs
assertion_line: 218
expression: terminal.backend()
---
> You are in /workspace/project
Do you trust the contents of this directory? Working with untrusted
contents comes with higher risk of prompt injection.
contents comes with higher risk of prompt injection. Trusting the
directory allows project-local config, hooks, and exec policies to
load.
› 1. Yes, continue
2. No, quit
@@ -53,10 +53,13 @@ impl WidgetRef for &TrustDirectoryWidget {
column.push(
Paragraph::new(
"Do you trust the contents of this directory? Working with untrusted contents comes with higher risk of prompt injection.".to_string(),
"Do you trust the contents of this directory? Working with untrusted \
contents comes with higher risk of prompt injection. Trusting the \
directory allows project-local config, hooks, and exec policies to load."
.to_string(),
)
.wrap(Wrap { trim: true })
.inset(Insets::tlbr(/*top*/ 0, /*left*/ 2, /*bottom*/ 0, /*right*/ 0)),
.wrap(Wrap { trim: true })
.inset(Insets::tlbr(/*top*/ 0, /*left*/ 2, /*bottom*/ 0, /*right*/ 0)),
);
column.push("");