mirror of
https://github.com/openai/codex.git
synced 2026-10-19 17:28:46 +00:00
Allow bundled browser plugins to run executor cleanup hooks (#40993)
## Why Executor plugin manifests are unsigned, so cleanup hooks must remain limited to explicitly trusted plugin identities and MCP targets. ## What changed - Allow the bundled Browser, Chrome, Chrome Dev, and Chrome Internal plugins to run the existing `Stop` hook for `node_repl.turn_ended`. - Continue allowing the bundled Computer Use plugin and rejecting unlisted or lookalike marketplace identities. ## Testing - Extend manifest-filtering coverage for unlisted bundled plugins and marketplace name variants. GitOrigin-RevId: 1ad5d679a1530994df5a9628c2117ce509fec9ad
This commit is contained in:
committed by
copyberry
parent
a98b94625e
commit
0340e12f5d
@@ -18,21 +18,47 @@ struct AllowlistedExecutorPluginHook {
|
||||
}
|
||||
|
||||
// Executor plugin manifests are unsigned, so temporarily hardcode the expected
|
||||
// bundled cleanup hook identity and MCP target until plugin signing lands.
|
||||
const ALLOWLISTED_EXECUTOR_PLUGIN_HOOKS: &[AllowlistedExecutorPluginHook] =
|
||||
&[AllowlistedExecutorPluginHook {
|
||||
// bundled plugin identities and cleanup MCP target until plugin signing lands.
|
||||
const ALLOWLISTED_EXECUTOR_PLUGIN_HOOKS: &[AllowlistedExecutorPluginHook] = &[
|
||||
AllowlistedExecutorPluginHook {
|
||||
plugin_id: "browser@openai-bundled",
|
||||
event: HookEventName::Stop,
|
||||
server: "node_repl",
|
||||
tool: "turn_ended",
|
||||
},
|
||||
AllowlistedExecutorPluginHook {
|
||||
plugin_id: "chrome@openai-bundled",
|
||||
event: HookEventName::Stop,
|
||||
server: "node_repl",
|
||||
tool: "turn_ended",
|
||||
},
|
||||
AllowlistedExecutorPluginHook {
|
||||
plugin_id: "chrome-dev@openai-bundled",
|
||||
event: HookEventName::Stop,
|
||||
server: "node_repl",
|
||||
tool: "turn_ended",
|
||||
},
|
||||
AllowlistedExecutorPluginHook {
|
||||
plugin_id: "chrome-internal@openai-bundled",
|
||||
event: HookEventName::Stop,
|
||||
server: "node_repl",
|
||||
tool: "turn_ended",
|
||||
},
|
||||
AllowlistedExecutorPluginHook {
|
||||
plugin_id: "computer-use@openai-bundled",
|
||||
event: HookEventName::Stop,
|
||||
server: "node_repl",
|
||||
tool: "turn_ended",
|
||||
}];
|
||||
},
|
||||
];
|
||||
|
||||
/// Returns accepted inline hook sources from executor-discovered plugin manifests.
|
||||
///
|
||||
/// Executor scoped hooks are best-effort because executor capabilities can become available
|
||||
/// after earlier lifecycle events have passed.
|
||||
///
|
||||
/// Note: Executor manifests are not signed yet, so temporarily we only admit the known Computer Use cleanup hook.
|
||||
/// Note: Executor manifests are not signed yet, so temporarily we only admit the known cleanup
|
||||
/// hook from the bundled Browser, Chrome, Chrome Dev, Chrome Internal, and Computer Use plugins.
|
||||
pub fn executor_plugin_hook_sources(
|
||||
snapshot: &ExecutorCapabilityDiscoverySnapshot,
|
||||
) -> Vec<ExecutorPluginHookSource> {
|
||||
|
||||
@@ -186,10 +186,25 @@ fn ignores_unallowlisted_executor_plugin_hooks() {
|
||||
wrong_matcher["hooks"]["hooks"]["Stop"][0]["matcher"] = json!("unexpected");
|
||||
for (name, plugin_id, manifest) in [
|
||||
(
|
||||
"wrong plugin id",
|
||||
"unallowlisted bundled plugin",
|
||||
"another-plugin@openai-bundled",
|
||||
cleanup_hook_manifest(),
|
||||
),
|
||||
(
|
||||
"wrong marketplace",
|
||||
"computer-use@other",
|
||||
cleanup_hook_manifest(),
|
||||
),
|
||||
(
|
||||
"bundled alpha marketplace",
|
||||
"computer-use@openai-bundled-alpha",
|
||||
cleanup_hook_manifest(),
|
||||
),
|
||||
(
|
||||
"bundled marketplace suffix",
|
||||
"computer-use@fake-openai-bundled",
|
||||
cleanup_hook_manifest(),
|
||||
),
|
||||
("wrong event", "computer-use@openai-bundled", wrong_event),
|
||||
(
|
||||
"wrong handler",
|
||||
|
||||
Reference in New Issue
Block a user