[插件安全边界] tools/pre-execute 在 ask 审批前已执行,可先完成独立 Node.js 子进程 #1863
Replies: 2 comments 2 replies
|
Agreed with the finding, with an important framing: ask-approval is consent UX, not a sandbox boundary. Plugins are explicitly installed host code ? they can always import Node built-ins and run anything. Approval gates intent, not capability; it cannot retroactively undo a listener that ran host operations before returning That makes the practical fixes:
Tooling angle: ecosystem vetting plugins (dsh-plugin-vetting) already static-scan for exfiltration/credential patterns; a |
|
The lint is now shipped: dsh-plugin-doctor v1.9.0 adds
22/22 tests (3 new fixtures: absent / side-effect FAIL / clean PASS). Release: https://github.com/zoahdev/dsh-plugin-doctor/releases/tag/v1.9.0 This complements (not replaces) the three upstream fix directions: pure pre-execute contract, capability-restricted listener context, and docs clarifying approval = consent UX. |
Uh oh!
There was an error while loading. Please reload this page.
我发现了一个与工具审批执行顺序有关的安全缺陷。这可能导致用户看到审批请求时,产生该请求的插件监听器已经完成了宿主级操作,使审批无法为这些操作提供事前保护。
tools/pre-execute返回的{ kind: "ask" }并不是该监听器运行前取得的许可,而是监听器执行完成后的返回结果。插件必须先获得执行机会,才能返回ask。因此,当用户看到审批请求时,监听器在返回ask前等待并完成的操作已经发生。我使用本地无害 PoC 验证了这一点:
tools/pre-execute启动一个独立的 Node.js 子进程,等待其完成固定计算并正常close(code=0),随后才返回ask。用户拒绝工具调用能够阻止ToolDefinition.execute(),但无法阻止或撤销监听器在审批前已经完成的操作。实际执行顺序为:
测试环境
@deepseek-ai/dsh@0.1.0-rc.6v24.18.047f943859bef60e4160492346772ded9b24f765aWorkspace Writeask实际观察
我进行了拒绝轮和
Allow once对照轮:ToolDefinition.execute()没有执行。Allow once对照轮中,同样先完成子进程并显示审批;用户允许后,ToolDefinition.execute()才执行。runId、childPid和证明摘要。这说明拒绝机制本身仍然有效,但它只阻止后续工具主体,无法保护或撤销
tools/pre-execute中已经完成的操作。安全影响
当前审批顺序意味着:
tools/pre-execute监听器执行宿主 Node.js 操作的事前许可。ask创建审批请求;用户此时选择“拒绝”已经无法阻止或撤销这些操作。ToolDefinition.execute()的 dispatch。如果用户把审批 UI 理解为“本次工具调用尚未执行任何相关代码”,当前行为与这一安全预期不一致。如果
ask的安全语义是“在相关操作执行前取得用户许可”,审批判断需要发生在可产生副作用的监听器获得执行机会之前。否则,文档和审批 UI 应明确说明其保证范围仅为后续工具主体的 dispatch。出于安全考虑,我不会在公开讨论中提供完整 PoC、可直接运行的代码或原始测试日志。
All reactions