Repository navigation
fix: tighten WriteStdin permission boundary - #966
Conversation
EnglishAfter #969 landed, this became a semantic integration rather than a mechanical merge. I rechecked the permission boundary and resolved the overlap without folding the two request protocols together. The integrated model is:
The conflicts in the event types, SessionEvent-to-RuntimeEvent mapping, and permission engine were resolved around those invariants. The PR body now scopes the required capability explicitly to tool-permission requests. A post-integration review tightened the boundary further: both request protocols now require an explicit discriminant, and the Runtime mapper rejects a missing or unknown kind instead of normalizing it into either protocol. A real The integrated branch passes the root typecheck, full test suite, and production build. The final Runtime suite reports 1,600 passing tests with 7 existing skips. 简体中文#969 合并后,这次冲突已经不是机械合并,而是一次权限语义集成。我重新核对了权限边界,并在不把两种请求协议揉成一套的前提下解决了交集。 集成后的模型如下:
事件类型、SessionEvent 到 RuntimeEvent 的映射和 permission engine 中的冲突均围绕这些不变量解决。PR body 也已把必需能力明确限定为工具权限请求。 集成后的复核进一步收紧了边界:两种请求协议现在都必须携带显式判别字段;Runtime mapper 会拒绝缺失或未知的 kind,不会将其规范化为任一协议。真实 集成分支已通过根级 typecheck、完整测试和生产构建。最终 Runtime 测试为 1,600 项通过、7 项既有 skip。 |
Astro-Han
left a comment
There was a problem hiding this comment.
Reviewed independently — no defect findings. The WriteStdin boundary is enforced at the runtime layer (non-rememberable, forged-remember rejected), full input is rendered inertly, and protocol/back-compat holds. CI green, mergeable clean. Approving.
English
Part of #856.
Summary
WriteStdinauthorization bound to the exact invocation while retaining a bounded, redacted activity summary.ref, and resize as inert escaped text before deciding.WriteStdin, expose that capability on every tool-permission request, and enforce it at the Runtime boundary.Why
The ordinary activity projection is intentionally bounded and redacted. It is suitable for transcripts and compact tool rows, but not sufficient as the only authorization view: a meaningful suffix may otherwise be outside the preview.
Turn memory is also unsafe for terminal input. The same bytes can perform a different action after the terminal reaches another prompt, so allowing one
WriteStdininvocation must not silently authorize a later one.Design
falseforWriteStdin.allow + rememberForTurnresponse.deny + rememberForTurnhas no authorization effect and should still resolve the pending request normally.The implementation reuses one canonical
WriteStdinargument parser for permission and activity projections. It does not introduce another request shape or duplicate resize rules.Scope
This PR covers the
WriteStdinpermission policy, Runtime enforcement, and Desktop/TUI human-facing projection. Canonical argument ownership and the TUI permission FIFO are already provided by #884 and #885.The one-shot
additional_permissionsprotocol remains a separate request kind with its ownallow_once/denycontract; it does not reuse theWriteStdininspector or turn-memory UI.It does not change PTY delivery semantics, runtime-resource
refvalidation, process lifecycle, persistence, or Headless/subagent capability. Thequeuedinput result and bounded canonicalrefcontract remain a separate follow-up from #856.Verification
Root typecheck, tests, and build pass on the integrated branch. Real Storybook interaction covers the bounded collapsed view, explicit full inspection, inert control-character rendering, full suffix visibility, and the absence of a turn-memory control. The completed interaction was also exercised through Electron and the Otty TUI for allow, deny, non-reused approval, and PTY cleanup.
No dependency, CI, storage migration, compatibility alias, or dual permission payload is added.
简体中文
属于 #856 的一部分。
摘要
WriteStdin授权始终绑定精确调用,同时保留有界、脱敏的 activity 摘要。ref和 resize;内容以不可执行的转义文本展示。WriteStdin的回合内权限记忆,在每个工具权限请求上表达该能力,并由 Runtime 强制执行。原因
普通 activity 投影会有意保持有界和脱敏,适合 transcript 与紧凑工具行,却不应成为唯一授权视图,否则有意义的输入后缀可能位于预览之外。
Turn memory 对终端输入同样不安全。终端到达另一个提示符后,相同字节可能执行不同操作,因此允许一次
WriteStdin不应静默授权稍后的另一次调用。设计
WriteStdin设为false。allow + rememberForTurn响应。deny + rememberForTurn不会产生授权效果,应正常结束 pending request。实现让 permission 与 activity 投影复用同一个 canonical
WriteStdin参数解析器,没有引入另一种请求 shape,也没有重复维护 resize 规则。范围
本 PR 覆盖
WriteStdinpermission policy、Runtime 强制约束,以及 Desktop/TUI 的人类可见投影。Canonical 参数所有权和 TUI 权限 FIFO 已由 #884 与 #885 提供。一次性的
additional_permissions协议仍是独立请求类型,使用自身的allow_once/deny契约;它不会复用WriteStdin检查器或 turn-memory UI。本 PR 不修改 PTY 送达语义、runtime-resource
ref校验、进程生命周期、持久化或 Headless/subagent 能力。输入结果的queued语义与有界 canonicalref契约仍是 #856 中的独立后续。验证
集成分支的根级 typecheck、测试与 build 均通过。真实 Storybook 交互覆盖默认有界视图、主动展开完整内容、控制字符不可执行展示、完整后缀可见,以及不出现 turn-memory 控件。完成态交互还通过 Electron 与 Otty TUI 验证了允许、拒绝、授权不复用和 PTY 清理。
本 PR 不增加依赖、CI、存储迁移、兼容别名或双重权限 payload。