Repository navigation
fix(core): 严格审批模式下每次终端输入都重新审批 - #271
Merged
Merged
Conversation
added 2 commits
September 19, 2026 05:52
approval_policy = "untrusted" 原本只审批一次性命令:模型批准一个 `bash -i` 后即可用 write_stdin 往持久终端里发任意命令而不再被问(write_stdin_approval 特性默认关闭,且权限 未变时直接放行)。现在严格策略下每次非空终端输入都走人工审批(仅单独 Ctrl-C 例外),不 依赖该特性也不看权限是否变化,审批理由带 "Strict approval policy" 前缀。 - 新增 core 集成测试 unified_exec_strict_policy:批准 shell 启动,后续两次 write_stdin 分别拒绝/批准,只有批准的写入 marker,拒绝的以 rejection 返回给模型;去掉修复即失败 - 冒烟脚本增加第三阶段:批准 /bin/sh -i 后 write_stdin 必须再次审批(kind writeStdin), 拒绝后无痕;mock 从服务端输出解析真实 session id - 文档说明持久终端同样受控,以及操作者自写的 allow 规则 / PermissionRequest hook 是 唯一能跳过提示的途径
修复严格审批模式的持久终端绕过后发布;Cargo.lock 仅工作区 crate 版本行变化,23 份状态卡 快照版本号同步。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
补上严格审批模式(
approval_policy = "untrusted")的一个绕过:模型批准一次bash -i后,可以用write_stdin往这个持久终端里发任意命令而不再被问(write_stdin_approval特性默认关闭,且权限未变时直接放行)。现在严格策略下每次非空终端输入都重新走人工审批(仅单独 Ctrl-C 例外),不依赖该特性也不看权限是否变化,审批理由带 "Strict approval policy" 前缀。改动
core/src/unified_exec/stdin_approval.rs:UnlessTrusted时跳过特性门与"权限未变"短路。core/tests/suite/unified_exec_strict_policy.rs:批准 shell 启动,后续两次write_stdin分别拒绝/批准,只有批准的写入 marker,拒绝的以 rejection 返回给模型;去掉修复后该测试失败(等待审批事件超时)。scripts/zuno_standalone_smoke.py第三阶段:批准/bin/sh -i后write_stdin必须再次审批(kindwriteStdin),拒绝后无痕;mock 从服务端输出解析真实 session id。allow规则 /PermissionRequesthook 是唯一能跳过提示的途径,严格 profile 不附带。验证
codex-core --test all的 unified_exec_strict_policy / stdin_approval / stdin_review_size 5 个测试通过,stdin_approval 单测 8 个通过,clippy core-D warnings清洁,tui status/update 68 个测试通过。python:3.12-alpine容器三阶段通过(stdin 阶段审批 kinds['command','writeStdin']);FROM scratch容器--version输出zuno 0.154.2。🤖 Generated with Claude Code