mirror of
https://github.com/openai/codex.git
synced 2026-11-12 06:40:35 +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:
1 parent
a98b94625e
commit
0340e12f5d
2 files changed
+47
-6
No files matched your search
@@ -18,21 +18,47 @@ struct AllowlistedExecutorPluginHook {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Executor plugin manifests are unsigned, so temporarily hardcode the expected
|
// Executor plugin manifests are unsigned, so temporarily hardcode the expected
|
||||||
// bundled cleanup hook identity and MCP target until plugin signing lands.
|
// bundled plugin identities and cleanup MCP target until plugin signing lands.
|
||||||
const ALLOWLISTED_EXECUTOR_PLUGIN_HOOKS: &[AllowlistedExecutorPluginHook] =
|
const ALLOWLISTED_EXECUTOR_PLUGIN_HOOKS: &[AllowlistedExecutorPluginHook] = &[
|
||||||
&[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",
|
plugin_id: "computer-use@openai-bundled",
|
||||||
event: HookEventName::Stop,
|
event: HookEventName::Stop,
|
||||||
server: "node_repl",
|
server: "node_repl",
|
||||||
tool: "turn_ended",
|
tool: "turn_ended",
|
||||||
}];
|
},
|
||||||
|
];
|
||||||
|
|
||||||
/// Returns accepted inline hook sources from executor-discovered plugin manifests.
|
/// Returns accepted inline hook sources from executor-discovered plugin manifests.
|
||||||
///
|
///
|
||||||
/// Executor scoped hooks are best-effort because executor capabilities can become available
|
/// Executor scoped hooks are best-effort because executor capabilities can become available
|
||||||
/// after earlier lifecycle events have passed.
|
/// 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(
|
pub fn executor_plugin_hook_sources(
|
||||||
snapshot: &ExecutorCapabilityDiscoverySnapshot,
|
snapshot: &ExecutorCapabilityDiscoverySnapshot,
|
||||||
) -> Vec<ExecutorPluginHookSource> {
|
) -> Vec<ExecutorPluginHookSource> {
|
||||||
|
|||||||
@@ -186,10 +186,25 @@ fn ignores_unallowlisted_executor_plugin_hooks() {
|
|||||||
wrong_matcher["hooks"]["hooks"]["Stop"][0]["matcher"] = json!("unexpected");
|
wrong_matcher["hooks"]["hooks"]["Stop"][0]["matcher"] = json!("unexpected");
|
||||||
for (name, plugin_id, manifest) in [
|
for (name, plugin_id, manifest) in [
|
||||||
(
|
(
|
||||||
"wrong plugin id",
|
"unallowlisted bundled plugin",
|
||||||
|
"another-plugin@openai-bundled",
|
||||||
|
cleanup_hook_manifest(),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"wrong marketplace",
|
||||||
"computer-use@other",
|
"computer-use@other",
|
||||||
cleanup_hook_manifest(),
|
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 event", "computer-use@openai-bundled", wrong_event),
|
||||||
(
|
(
|
||||||
"wrong handler",
|
"wrong handler",
|
||||||
|
|||||||
Reference in new issue
Block a user