mirror of
https://github.com/openai/codex.git
synced 2026-11-07 20:30:33 +00:00
Reject NUL bytes in reviewed terminal input (#41354)
## Why Manual terminal-input approvals shell-quote the proposed input, which cannot preserve NUL bytes for an accurate review. ## What changed Reject terminal input containing a NUL byte before creating an approval request or sending any of the input to the terminal. ## Testing Extend the unreviewable-input integration test to cover both oversized input and NUL-containing input, and verify that rejected input is not executed. GitOrigin-RevId: e738c59ba5570012663bf6168ad052be237ca226
This commit is contained in:
@@ -217,6 +217,12 @@ impl ProcessEntry {
|
||||
if sandbox_permissions == SandboxPermissions::UseDefault && !strict_auto_review {
|
||||
return Ok(None);
|
||||
}
|
||||
// Manual approvals shell-quote the input, which cannot preserve NUL bytes.
|
||||
if input.contains('\0') {
|
||||
return Err(approval_error(
|
||||
"terminal input contains a NUL byte and cannot be reviewed safely",
|
||||
));
|
||||
}
|
||||
let reason = permissions
|
||||
.approval_reason(sandbox_permissions)
|
||||
.map_err(approval_error)?;
|
||||
|
||||
Reference in New Issue
Block a user