ParseGap 框架揭示编码 Agent 命令审批与 Shell 执行存在解析分歧
ParseGap: Testing What Coding Agents Authorize and What Shells Execute
做 Agent 沙箱和权限策略的开发者必读:它用差分测试证明 8 个主流编码 Agent 的审批器和 Bash 看到的命令不一样,连 Codex CLI 的 allow 规则都能关掉自家沙箱。附带的 ShellPlan 方案有形式化证明和实测数据,可以直接参考落地。
论文提出 ParseGap,一个差分测试框架:把同一条命令分别交给厂商原始审批检查器和 GNU Bash 5.2 在隔离容器中执行,一旦被批准的命令产生违反策略的运行时效果即标记违规。核心问题是 LLM 编码 Agent 用解析器裁决命令字符串,却把原始字符串直接交给 shell,审批和执行读到的是两种解释。
在 8 个生产级编码 Agent 上,ParseGap 定位出 17 个根因,分布在三层分歧边界:解析层(上游 tree-sitter-bash 缺陷让 Mistral Vibe 和 Gemini CLI 看不到第二条命令)、工具层(所有检查器都放行 read-only 二进制,但参数可写文件或启动程序,55 个案例中 9-47 个命中)、隔离层(OpenAI Codex CLI 的一条 allow 规则会关闭其只读 OS 沙箱)。实测中,两个前沿模型在全部 16 个 Agent-模型组合里触发策略违规,其中 14 个是在已配置限制的情况下发生的。
作者随后设计 ShellPlan:把严格的 Bash 子集一次性编译成类型化执行计划,用正向能力规范校验工具参数,并通过 execve 直接派发,绕过 shell。在形式化操作模型上证明了单一解释派发及可触碰程序与文件的边界;ShellPlan 在六个静态套件中拦截全部 4,174 个主动攻击,十个模型 Agent 基准中 0/90 命中(未防护时 62/90),中位门控延迟 1.28 ms,前沿模型标准开发集完成率保持 36/36(100%),整体 74/100,外部过度放行 0/348。
ParseGap: Testing What Coding Agents Authorize and What Shells Execute
LLM coding agents authorize shell commands by parsing a command string against a policy and passing the raw string to a system shell, so the gate adjudicates one reading while the shell executes another. We present ParseGap, a differential testing framework that runs each command through an unmodified vendor checker and GNU Bash 5.2 in an isolated container, flagging a violation whenever an approved command produces policy-violating runtime effects. Across eight production coding agents, ParseGap identifies 17 root causes across three divergence boundaries: at the parse, where an upstream tree-sitter-bash defect hides a second command from Mistral Vibe and Gemini CLI; at the utility, where every checker permits read-only binaries whose arguments write files or launch programs (9-47 of 55 cases); and at confinement, where an allow rule in OpenAI Codex CLI disables its read-only OS sandbox. Live trials across two frontier models triggered policy violations in all 16 agent-model pairs (14 under configured restrictions). To eliminate the second reading, we design ShellPlan, which compiles a strict Bash subset once into a typed execution plan, validates utility arguments against positive capability specifications, and dispatches approved plans directly via execve without a shell. Over a formal operational model, we prove single-interpretation dispatch and bound touched programs and files under audited assumptions. ShellPlan admitted 0/4,174 active attacks across six static suites and 0/90 hits in a ten-model agent benchmark (62/90 unguarded) at 1.28 ms median gate latency, preserving 36/36 (100%) frontier standard-dev completion (74/100 overall) and 0/348 external over-allows outside modeled exceptions.
This report is categorized under AITOP's "Papers" desk. Within our cross-regional analytical framework, it directly maps to AI developer toolchains, coding agents, and engineering workflows. Key entities and technical topics under continuous tracking include coding agents, ParseGap, ShellPlan, OpenAI Codex CLI.
Primary source verification: published directly by arXiv: OpenAI with first-party authority.