mirror of
https://github.com/openai/codex.git
synced 2026-11-02 16:20:35 +00:00
add --dangerously-bypass-hook-trust CLI flag (#21768)
# Why Hook trust happens through the TUI in `/hooks` so it can block non-interactive use cases. This flag will allow users that are using codex headlessly to bypass hooks when they want to. # What This adds one invocation-scoped escape hatch. - the CLI flag sets a runtime-only `bypass_hook_trust` override; there is no durable `config.toml` setting - hook discovery still respects normal enablement, so explicitly disabled hooks remain disabled - we show a `--dangerously-bypass-hook-trust is enabled. Enabled hooks may run without review for this invocation.` message on startup so accidental use is visible in both interactive and exec flows This keeps “enabled” and “trusted” as separate concepts in the normal path, while giving CI/E2E callers a stable way to opt into the exceptional path when they already control the hook set.
This commit is contained in:
1 parent
934a40c7d9
commit
392e94e9ea
16 files changed
+252
-16
No files matched your search
@@ -304,6 +304,18 @@ async fn ignore_same_thread_resume_allows_reattaching_displayed_inactive_thread(
|
||||
assert!(app.transcript_cells.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bypass_hook_trust_startup_warning_snapshot() {
|
||||
let rendered = lines_to_single_string(
|
||||
&history_cell::new_warning_event(
|
||||
"`--dangerously-bypass-hook-trust` is enabled. Enabled hooks may run without review for this invocation."
|
||||
.to_string(),
|
||||
)
|
||||
.display_lines(/*width*/ 80),
|
||||
);
|
||||
|
||||
assert_app_snapshot!("bypass_hook_trust_startup_warning", rendered);
|
||||
}
|
||||
#[tokio::test]
|
||||
async fn enqueue_primary_thread_session_replays_buffered_approval_after_attach() -> Result<()> {
|
||||
let (mut app, mut app_event_rx, _op_rx) = make_test_app_with_channels().await;
|
||||
|
||||
@@ -928,6 +928,7 @@ pub async fn run_main(
|
||||
codex_linux_sandbox_exe: arg0_paths.codex_linux_sandbox_exe.clone(),
|
||||
main_execve_wrapper_exe: arg0_paths.main_execve_wrapper_exe.clone(),
|
||||
show_raw_agent_reasoning: cli.oss.then_some(true),
|
||||
bypass_hook_trust: cli.bypass_hook_trust.then_some(true),
|
||||
additional_writable_roots: additional_dirs,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
---
|
||||
source: tui/src/app/tests.rs
|
||||
expression: rendered
|
||||
---
|
||||
⚠ `--dangerously-bypass-hook-trust` is enabled. Enabled hooks may run without
|
||||
review for this invocation.
|
||||
Reference in new issue
Block a user