Repository navigation
fix(ptc): stop preparing result caches under full access - #567
tietoumiao wants to merge 1 commit into
Conversation
A danger-full-access session narrowed itself to workspace-write before asking the host for a cache grant, so the provider stamped the workspace with a standing Low integrity level that later sessions inherited. Prepare only for a narrowed session: workspace-write keeps the cache-only seam and the legacy confine pair, while full access writes a private directory beside the system temp root and asks the host for nothing. A session narrowed after using full access drops the plain location and prepares again instead of writing outside its grant (T-Auto#411).
|
This overlaps #544's fix for #411, but chooses a new Windows cache authority path instead of retaining the cache-only host seam and declining legacy full-access caching. Two points need resolving before adopting this alternative:
This is a source review of head |
Nicholas023
left a comment
There was a problem hiding this comment.
审查结论:REQUEST_CHANGES — 建议关闭
核心方向(不在 full access 下准备 workspace)是对的,但实现里有两个必须解决的问题。
1. 「私有目录」不成立(阻断)
windowsFullAccessCacheLocation() 用 mkdirSync(..., { mode: 0o700 }) 并只检查目录/非符号链接。本机实测:
text fs.statSync(dir).mode & 0o777 = 0o666 ← mode 在 Windows 上被忽略 icacls: NT AUTHORITY\SYSTEM:(I)(OI)(CI)(F) BUILTIN\Administrators:(I)(OI)(CI)(F) <user>:(I)(OI)(CI)(F) ← 全部是继承授权
Node 文档明确说明 mode 在 Windows 上不支持。被替换掉的 POSIX ownership/mode 检查在这里没有等价物;也不校验 owner,且 EEXIST 分支会接受任意已存在的叶子目录。
2. fixture unavailable 被计为通过(阻断)
同一个 worktree 实跑:
text fixture unavailable: dsh-ops-worker.exe could not store a result … {"code":"ACCESS_DENIED",…} ok the unconfined full-access cache stores a large native reference dsh-ops result-storage-cache-prep: all 5 checks passed
断言已被绕过(没有 refId),却显示 ok 并计入 pass。这与 AGENTS.md 的「skip 不算 pass / No silent skips」直接冲突。基线同一套件只有 3 条、全绿。
3. 新增分支无断言
result-storage.ts 里「full-access 缓存位置在收窄为 workspace-write 时丢弃」的分支没有测试覆盖。
已核实为真的部分
- 0.5.0 基线确实在
danger-full-access下调用confine()且 mode 为["workspace-write"](问题真实存在) - PR 声称的 workspace 标签变化方向成立
处置建议
关闭。 采纳 #544(保留 cache-only host seam;legacy host 上明确拒绝缓存)。若要保住 full-access 下的 spill,应在 #544 基础上做可撤销的 temp-only grant(Low 标签 + tempWriteSid ACE),并且测试拿不到真实 ref 时必须报 skip/failure 而不是 pass。
|
Closing — #544 owns this and is in |
Closes #411
What was wrong
Even when the session sandbox is
danger-full-access,src/kernel/result-storage.ts:120-131narrowed the effective mode to
workspace-writebefore preparing the result cache, and thepreparation path called
prepareWorkspace/prepareResultStorage/confine. On Windows thatstamps the workspace with a standing
Mandatory Label\Low Mandatory Leveland hands back a storageroot carrying
windowsWriteSid, so a later session inherits a narrowed, labelled workspace.Measured live with the real
LocalSandboxProvideron this host: workspace label(none)→Mandatory Label\Low Mandatory Level:(OI)(CI)(NW)before the change;(none)after.The change
src/kernel/result-storage.ts— under full access, write a plain private%TEMP%\dsh-ops-results-<key>directory and call neither preparation seam;workspace-writeandread-onlykeep their existing preparation and confinement, unchanged.test/result-storage-cache-prep.test.mjs— assertsprepares === 0 && confines === 0for fullaccess, no
windowsWriteSid, the storage root under the real temp dir and outside the workspace,and that a
workspace-writesession afterwards still prepares exactly once. The cache round-tripis a separate named check.
docs/result-budgets.md+docs/结果预算.md+docs/CHANGELOG.md.Deliberately not done: no change to the confined modes, no new host seam (the pinned host has no
prepareResultStorageAPI), and no test that silently passes.Validation
full access prepares no grant…(prepares1 vs 0)docs/CHANGELOG.md## [Unreleased]:已加(EN+ZH)pull_request事件触发,届时回填CI required的 run URLEnvironment
065cd7fnpm ci --ignore-scripts;worker 由cargo build --release --locked+ stage未验证 / 风险披露
windows_write_sid的缓存写入"在本机被 OS 拒绝(
ACCESS_DENIED);这条以具名的fixture unavailable: …打印出来,不算通过,也不改产品代码。用 0.4.1 参考 worker 时该 round-trip 完整通过(180 KB 引用 + PTC 分页)。
CI