mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Preserve executor paths in Guardian approval reviews (#42838)
## Why Guardian approval actions can contain paths from a remote executor whose path convention differs from the host, such as Windows paths reviewed on a POSIX host. Converting those paths to host-native absolute paths prevents the action from being reviewed. ## What changed - Render command working directories using the executor's reported path convention, and preserve URI-backed paths for attribution. - Carry foreign command and patch paths through Guardian events and app-server schemas as legacy path strings. - Bound remote plugin attribution within the overall review deadline and reject Guardian action payloads that exceed the review byte limit. ## Testing - Cover Windows and POSIX executor path rendering, foreign patch paths, protocol round trips, oversized payload rejection, and remote Guardian review context. GitOrigin-RevId: 38be0fcdac897139519e74e077eb5cb4f8f8017e
This commit is contained in:
1 parent
83b62a02fa
commit
773f0b081d
27 files changed
+442
-203
No files matched your search
@@ -845,15 +845,24 @@ impl UnifiedExecProcessManager {
|
||||
entry.stdin_approval(context, request.input, strict_auto_review)?
|
||||
};
|
||||
if let Some((approval, approval_reason)) = approval {
|
||||
let unreviewable_input_error = || {
|
||||
UnifiedExecError::StdinApproval(ToolError::Rejected(
|
||||
"terminal input and permission details are too large to review safely; use a smaller input or start a new terminal with fewer grants".to_string(),
|
||||
))
|
||||
};
|
||||
let reviewed = crate::guardian::format_guardian_action_pretty(
|
||||
&approval.clone().into_guardian_request().map_err(|err| {
|
||||
UnifiedExecError::StdinApproval(ToolError::Rejected(err.to_string()))
|
||||
})?,
|
||||
&approval
|
||||
.clone()
|
||||
.into_guardian_request(/*exec_command_cwd_convention*/ None)
|
||||
.map_err(|err| {
|
||||
UnifiedExecError::StdinApproval(ToolError::Rejected(err.to_string()))
|
||||
})?,
|
||||
)
|
||||
.map_err(|err| UnifiedExecError::StdinApproval(ToolError::Rejected(err.to_string())))?;
|
||||
.map_err(|_| unreviewable_input_error())?;
|
||||
// Bound the entire serialized action plus its reason, including JSON
|
||||
// escaping. Reject, never execute an unreviewed tail.
|
||||
let oversized = reviewed.text.len().saturating_add(approval_reason.len()) > 8_000;
|
||||
let oversized = reviewed.text.len().saturating_add(approval_reason.len())
|
||||
> crate::guardian::GUARDIAN_MAX_ACTION_BYTES;
|
||||
let size_check_result = if reviewed.truncated {
|
||||
"formatter_truncated"
|
||||
} else if oversized {
|
||||
@@ -872,9 +881,7 @@ impl UnifiedExecProcessManager {
|
||||
&[("result", size_check_result), ("input_kind", input_kind)],
|
||||
);
|
||||
if reviewed.truncated || oversized {
|
||||
return Err(UnifiedExecError::StdinApproval(ToolError::Rejected(
|
||||
"terminal input and permission details are too large to review safely; use a smaller input or start a new terminal with fewer grants".to_string(),
|
||||
)));
|
||||
return Err(unreviewable_input_error());
|
||||
}
|
||||
let approval_context = ApprovalContext {
|
||||
review_context: GuardianReviewContext::from(&context.step_context),
|
||||
|
||||
Reference in new issue
Block a user