Uh oh!
There was an error while loading. Please reload this page.
feat: replace tool permissions with session sandbox boundaries - #1581
Conversation
6f15924 to
d481739CompareEnglishReview outcomeRequest changes. I reviewed the final PR head The latest rebase and the final Contract used for this reviewThe accepted #1564 contract requires:
The alternative proposals to enable network by default, automatically fall through to Bypass, or treat user-provided paths as implicit authorization were explicitly rejected in the issue discussion. These findings are evaluated against the accepted issue body, not those alternatives. Blocking findings1. [P1] Managed filesystem tools fail open when the filesystem worker is unavailableDesktop and CLI conditionally omit the filesystem worker when the platform cannot provide the built-in worker sandbox. Relevant paths: I reproduced this on the final head: a Write call under an Managed execution must return an enforcement-unavailable failure before reaching the host executor. The host path should only be reachable for an explicit Bypass or harness-owned External boundary. 2. [P1] The first process-network expansion has no valid request pathAuto starts with restricted process network, but Bash has no declarative network requirement. A denied command returns only a likely sandbox-denial signal, without Runtime guidance simultaneously states that the Agent must not infer an expansion and may request one only after a tool returns an exact expansion: I reproduced an This needs a declarative, non-authorizing process-network requirement or an equally reliable backend signal that can produce the exact expansion without parsing command text. 3. [P1] An External session can resume in Desktop/TUI as Auto while Bash runs without a Maka sandboxImported session bundles can restore an External boundary. Bash treats both Bypass and External as instructions to skip the Maka sandbox: Desktop maps every non-Bypass boundary to Auto, while TUI session switching continues to project the legacy
External sessions must be rejected by ordinary interactive surfaces unless an explicit external-isolation owner is injected. External must also never be presented as Auto. Additional correctness gaps4. [P2] Deep Research can request and receive write or network expansionDeep Research starts with a managed read-only profile, but Desktop still includes the complete builtin surface and unconditionally exposes Storage applies an approved expansion to any managed profile, including read-only: I reproduced approval of a network expansion on a Deep Research session. The resulting profile was still named The Deep Research surface should omit mutation tools and the boundary-request tool, and its internal read-only boundary must not be expandable into write or process-network authority. 5. [P2] Child boundary persistence is fixed, but filesystem execution does not fully inherit Bypass or ExternalThe parent boundary is now persisted into the child correctly. However, the child header still uses the Agent definition’s legacy permission mode, and the filesystem worker only consumes managed boundaries: For an inherited Bypass or External boundary, filesystem execution falls back to the child definition’s legacy profile. The same child can therefore run Bash according to the inherited boundary while Read/Write/Edit follow a different authority. Boundary handling in the filesystem client should be exhaustive: managed, bypass, and external must each have explicit semantics, with no fallback to 6. [P2] Non-interactive Auto can still return exit code 0 after an unresolved boundary failure
A filesystem tool can instead return An unresolved boundary requirement must become a terminal non-interactive invocation outcome, independently of whether a request event was published. 7. [P2] A session bundle does not read its header and boundary from one SQLite snapshotThe bundle exporter writes selected session metadata and the selected boundary through two independent exporter calls: A concurrent Auto/Bypass transition between those reads can export a header from one revision and a boundary from another. Import then accepts both as the new genesis state. Storage should provide one read transaction that returns an immutable portable Implementation-quality concernThe Runtime public boundary contract still permits the authoritative reader to be absent: All current first-party production call sites appear to provide the reader, so I am not treating this as a separate exploit. However, the public API still silently reconstructs authority from The boundary reader should be required. Interactive expansion support can be represented separately as an explicit enabled/disabled capability. There are also several source-regex and collaborator-call tests that lock implementation shape rather than public behavior. I do not use those as the primary basis for this review, but they should be replaced with behavioral coverage while these paths are being corrected. ValidationOn final head
The green suite validates the supported sandbox path, but it does not cover the fail-open worker-unavailable path or the cross-surface inconsistencies above. 简体中文审查结论Request changes。 我基于 #1564 的已接受契约与本 PR body 声明的保证,对最终 head 最新 rebase 与最终的 本次审查采用的契约已接受的 #1564 契约要求:
Issue 讨论中关于默认启用 network、自动退化到 Bypass,以及把用户给出的路径视为隐式授权的替代提案已经被明确拒绝。以下 findings 以已接受的 issue body 为准,不采用这些替代提案。 阻塞问题1. [P1] Filesystem worker 不可用时,managed filesystem tool 会 fail open当平台无法提供内置 worker sandbox 时,Desktop 与 CLI 会有条件地省略 filesystem worker。 相关路径: 我在最终 head 上完成了复现:未提供 worker 时, Managed execution 必须在进入 host executor 前返回 enforcement-unavailable failure。Host 路径只能由显式 Bypass 或 harness-owned External boundary 访问。 2. [P1] 首次 process-network expansion 没有合法的请求路径Auto 默认限制 process network,但 Bash 没有声明 network requirement 的字段。命令被拒绝时只返回可能的 sandbox-denial signal,不包含 Runtime guidance 同时要求 Agent 不得推断 expansion,且只有在工具返回精确 expansion 后才能请求: 我复现了带有 这里需要一个声明式且本身不授予权限的 process-network requirement,或同样可靠的 backend signal,以便在不解析 command text 的情况下生成精确 expansion。 3. [P1] External session 可以在 Desktop/TUI 中以 Auto 恢复,同时 Bash 不受 Maka sandbox 约束导入的 session bundle 可以恢复 External boundary。Bash 将 Bypass 和 External 都视为跳过 Maka sandbox 的指令: Desktop 把所有非 Bypass boundary 映射为 Auto,而 TUI session switching 继续投影 legacy
除非注入显式 external-isolation owner,否则普通交互式 surface 必须拒绝 External session。External 也绝不能显示为 Auto。 其他正确性缺口4. [P2] Deep Research 可以请求并获得 write 或 network expansionDeep Research 从 managed read-only profile 开始,但 Desktop 仍包含完整 builtin surface,并无条件暴露 Storage 会把已批准的 expansion 应用到任意 managed profile,包括 read-only: 我复现了 Deep Research session 的 network expansion approval。结果 profile 仍名为 Deep Research surface 应移除 mutation tool 与 boundary-request tool,其内部 read-only boundary 也不应扩张为 write 或 process-network authority。 5. [P2] Child boundary 已正确持久化,但 filesystem execution 没有完整继承 Bypass 或 ExternalParent boundary 现在已经能正确持久化到 child。但 child header 仍使用 Agent definition 的 legacy permission mode,而 filesystem worker 只消费 managed boundary: 对于继承的 Bypass 或 External boundary,filesystem execution 会退回 child definition 的 legacy profile。同一个 child 因而可能让 Bash 遵循 inherited boundary,却让 Read/Write/Edit 遵循另一套 authority。 Filesystem client 应穷举处理 managed、bypass 与 external,不能再退回 6. [P2] 非交互 Auto 在 boundary failure 未解决后仍可能返回退出码 0
Filesystem tool 也可能只把 未解决的 boundary requirement 必须成为非交互 invocation 的 terminal failure,不能依赖是否发布了 request event。 7. [P2] Session bundle 没有从同一个 SQLite snapshot 读取 header 与 boundaryBundle exporter 通过两个独立 exporter 调用写入 selected session metadata 和 selected boundary: 如果两次读取之间发生并发 Auto/Bypass transition,export 可能得到一个 revision 的 header 和另一个 revision 的 boundary。Import 随后会把两者共同接受为新的 genesis state。 Storage 应在一个 read transaction 内返回不可变的 portable 实现质量问题Runtime 的 public boundary contract 仍允许 authoritative reader 缺失: 当前 first-party production call site 看起来都提供了 reader,因此我没有把它作为独立 exploit。但 public API 仍会从 Boundary reader 应成为 required dependency。Interactive expansion support 可以单独表示为显式的 enabled/disabled capability。 此外,当前还有若干 source-regex 与 collaborator-call test,它们锁定 implementation shape,而不是验证 public behavior。我没有把这些测试作为本次 Request changes 的主要依据,但在修复上述路径时应将其替换为 behavioral coverage。 验证最终 head
当前绿色测试覆盖了受支持的 sandbox 路径,但没有覆盖上述 worker-unavailable fail-open 路径与跨 surface 不一致。 |
Astro-Han
commented
Jul 29, 2026
EnglishThank you for the detailed review. I reproduced the reported paths and updated the PR to head All seven findings have now been addressed:
The implementation-quality concern was also addressed. For the Desktop follow-up, Validation on
Could you please re-review the current head? 简体中文感谢这次详细审查。我复现了报告中的路径,并已把 PR 更新到 head 七项 findings 现已全部处理:
实现质量问题也已处理。 Desktop follow-up
能否请你基于当前 head 再 review 一次? |
EnglishI re-reviewed head Re-review outcomeThe following findings are resolved:
One finding remains open. [P2] Child filesystem execution still does not inherit Bypass or External semanticsThe parent The filesystem worker only consumes the supplied boundary when its kind is Bash, by contrast, explicitly skips the Maka sandbox for the inherited Bypass or External boundary: I reproduced the remaining mismatch on {"kind":"bypass","reason":"path_denied","stage":"validation","calls":0}
{"kind":"external","reason":"path_denied","stage":"validation","calls":0}The worker process was never launched. The operation was rejected by the legacy profile selected before sandbox execution. The explicit child tool allowlists correctly constrain which tools a child receives, but they do not make those tools use the inherited boundary. An implementation child can therefore run Bash according to inherited Bypass/External authority while Read/Write/Edit continue to use a different filesystem authority. Please make filesystem authority selection exhaustive over all ValidationOn
I did not find another blocker in the follow-up scope. The previous findings can remain resolved; only the child filesystem-boundary finding remains open. 简体中文我基于 head Re-review 结论以下 findings 已确认 resolved:
仍有一项 finding 未关闭。 [P2] Child filesystem execution 仍未继承 Bypass 或 External 语义Parent Filesystem worker 只有在 boundary kind 为 Bash 则会针对 inherited Bypass 或 External boundary 显式跳过 Maka sandbox: 我在 {"kind":"bypass","reason":"path_denied","stage":"validation","calls":0}
{"kind":"external","reason":"path_denied","stage":"validation","calls":0}Worker process 没有启动。操作在 sandbox execution 之前就被 legacy profile 拒绝。 显式 child tool allowlist 正确限制了 child 可以获得哪些工具,但没有让这些工具使用 inherited boundary。因此 implementation child 仍可能让 Bash 遵循 inherited Bypass/External authority,而 Read/Write/Edit 使用另一套 filesystem authority。 请对所有 验证在
在本次 follow-up 范围内没有发现其他 blocker。此前其余 findings 可以保持 resolved;目前只剩 child filesystem-boundary finding 未关闭。 |
Astro-Han
commented
Jul 29, 2026
EnglishThank you. I addressed the remaining child filesystem-boundary finding. The current head is The root cause was that the filesystem worker boundary was not explicit enough: it is a managed-only enforcement path, while Bypass and External execution must never be projected into it or reconstructed from a legacy child mode. The fix now covers both layers:
The regression coverage reproduces the inherited-child shape directly through builtin Fresh-eye validation also added bounded hardening around boundary narrowing, stale linked-child resume, External admission, descendant non-interactive failures, exact-write grant isolation, authority round-trips, and prompt response races. These remain separate atomic commits and do not reintroduce the generic permission or legacy mode paths. Validation on
Could you please re-review the current head? 简体中文感谢。我已经处理了最后一项 child filesystem-boundary finding。当前 head 为 根因是 filesystem worker 的职责边界不够明确:它只应是 Managed 的 enforcement path;Bypass 与 External execution 既不应进入 worker,也不能从 legacy child mode 重建权限。 修复现在覆盖两层:
回归测试通过 builtin Fresh-eye 验证还以有限范围补强了 boundary narrowing、stale linked-child resume、External admission、非交互后代失败、exact-write grant 隔离、authority round-trip 和 prompt response race。它们都保留为独立原子提交,也没有重新引入 generic permission 或 legacy mode 路径。
能否请你基于当前 head 再 review 一次? |
3f5443b to
c4a7062CompareM4n5ter
commented
Jul 29, 2026
EnglishI re-reviewed the latest head Re-review outcomeThe previously reported child filesystem-boundary mismatch is resolved. Builtin filesystem dispatch now follows the authoritative boundary, and the targeted builtin/client tests pass 20/20. Request changes. Three correctness blockers and four additional gaps remain. Blocking correctness findings1. [P1] A missing exact-write grant still blocks unrelated Bash commands on real Linux
Every exact-write entry in that profile remains a bind-mount source. If an undeclared exact target or its parent no longer exists, bubblewrap fails before executing the command. I reproduced this with an unrelated command: {"command":"true","result":"failed","stderr":"bwrap: Can't find source path .../removed-parent/stale.txt: No such file or directory"}The added unit test does not catch this because it uses a fake available sandbox manager and never executes the generated bubblewrap command. This is also the current required-CI failure: Linux sandbox smoke fails 6/7 with the same missing-source error. The per-invocation Linux mount plan should omit absent undeclared exact entries while safely preparing an exact target that the current invocation declares. This needs a real bubblewrap smoke test for both cases. 2. [P1] Legacy |
4c0af93 to
d01db12Compare58fdec7 to
6b82f24CompareUh oh!
There was an error while loading. Please reload this page.
#1581 replaced tool permissions with session sandbox boundaries and removed `PermissionEngine` from `@maka/runtime`, but left this test importing it and passing a `permissionEngine` dependency that the session-stream deps type no longer has. `main` has been red since: `tsc -p tsconfig.main.json` fails with TS2305, which takes `build:main` down and with it the typecheck, test, and e2e jobs on every branch. Nothing in production takes a `permissionEngine` any more, and the test's subject is usage readiness, so the import and the dependency go. No behavioural change and no replacement needed.
Summary
ExecutionBoundaryauthority.sandbox_boundary_requireddeltas orrequires_bypass; Bash diagnostics never parse commands or invent authority.Closes#1564
Verification
npm run build— passed across all workspaces.npm run test:dist— passed the complete repository suite with the workspace runner in serial mode, including script contracts (176/176), storage (733 passed, 1 skipped), Runtime (2675 passed, 9 skipped), Runtime Host (212/212), and Desktop (2964/2964).npm run format:check— passed, 1221 files checked.npm run lint— passed, 2304 files checked.npm run typecheck— passed across all workspaces.node --test packages/runtime/dist/__tests__/macos-seatbelt-smoke.test.js packages/runtime/dist/__tests__/filesystem-worker-smoke.test.js— passed (9/9), including exact outside-path expansion and restricted network behavior.npm run e2e -w @maka/desktop -- e2e/sandbox-boundary-takeover.spec.ts— passed (1/1), covering the visible Desktop composer takeover and approval journey.npm testcommand intermittently exhausted a Runtime Host test's local timing window under machine load. That package passed independently (212/212), and the complete serial repository run above passed; this PR does not broaden into unrelated test-harness timing changes.Migration and breaking change
askandexecutesessions enter the managed workspace-write boundary;exploreenters managed read-only;bypassremains bypass. First access durably records revision 0 without rewriting settled historical records.host_restartedduring recovery because their live continuation authority cannot survive the upgrade.maka rundefaults to Auto and cannot interactively expand a boundary, so it fails closed when expansion is requested. Only explicit--yolocreates or resumes a bypass session.Review focus
requires_bypass.