mirror of
https://github.com/openai/codex.git
synced 2026-11-16 06:54:36 +00:00
Require synchronous review for sensitive MCP actions (#41094)
## What changed - Recognize `codex_sensitive_action: true` on MCP approval elicitations. - Route marked actions to the synchronous Guardian reviewer instead of extension fast approval. Absent or false values preserve the existing path. - Cover ordinary and strict auto-review configurations, including marked, unmarked, and explicitly false metadata. GitOrigin-RevId: dce13d1696568ca81c8d2b08a7ef0d5f13e155bf
This commit is contained in:
1 parent
2c4a95736b
commit
89650c66f2
10 files changed
+240
-28
No files matched your search
@@ -322,7 +322,8 @@ async fn run_guardian_review(
|
||||
options: GuardianReviewOptions,
|
||||
) -> ReviewDecision {
|
||||
let turn = Arc::clone(context.turn());
|
||||
let requires_synchronous_review = reasons.retry.is_some()
|
||||
let requires_synchronous_review = options.require_synchronous_review
|
||||
|| reasons.retry.is_some()
|
||||
|| matches!(
|
||||
&request,
|
||||
GuardianApprovalRequest::ExecCommand {
|
||||
@@ -331,7 +332,8 @@ async fn run_guardian_review(
|
||||
} if sandbox_permissions.requires_escalated_permissions()
|
||||
);
|
||||
// Guardian V2 may satisfy ordinary reviews, including required-model reviews, but broader
|
||||
// permission requests and retries must run Guardian synchronously.
|
||||
// permission requests, retries, and elicitations requiring synchronous review must not use
|
||||
// extension fast approval.
|
||||
if (!turn
|
||||
.config
|
||||
.config_layer_stack
|
||||
@@ -368,6 +370,7 @@ async fn run_guardian_review(
|
||||
plugin_attribution_override,
|
||||
approval_request_source,
|
||||
external_cancel,
|
||||
require_synchronous_review: _,
|
||||
} = options;
|
||||
let target_item_id = guardian_request_target_item_id(&request).map(str::to_string);
|
||||
let assessment_turn_id = guardian_request_turn_id(&request, &turn.sub_id).to_string();
|
||||
@@ -739,6 +742,8 @@ pub(crate) struct GuardianReviewOptions {
|
||||
pub(crate) plugin_attribution_override: Option<PluginCommandAttribution>,
|
||||
pub(crate) approval_request_source: GuardianApprovalRequestSource,
|
||||
pub(crate) external_cancel: Option<CancellationToken>,
|
||||
/// Escalate from extension fast approval to the synchronous Guardian reviewer.
|
||||
pub(crate) require_synchronous_review: bool,
|
||||
}
|
||||
|
||||
/// Public entrypoint for approval requests that should be reviewed by guardian.
|
||||
@@ -760,6 +765,7 @@ pub(crate) async fn review_approval_request(
|
||||
plugin_attribution_override: None,
|
||||
approval_request_source: GuardianApprovalRequestSource::MainTurn,
|
||||
external_cancel: None,
|
||||
require_synchronous_review: false,
|
||||
},
|
||||
));
|
||||
review.await
|
||||
|
||||
@@ -1506,6 +1506,7 @@ async fn cancelled_guardian_review_emits_terminal_abort_without_warning() {
|
||||
plugin_attribution_override: None,
|
||||
approval_request_source: GuardianApprovalRequestSource::MainTurn,
|
||||
external_cancel: Some(cancel_token),
|
||||
require_synchronous_review: false,
|
||||
},
|
||||
)
|
||||
.await;
|
||||
|
||||
Reference in new issue
Block a user