Repository navigation
fix(state): ACL guard names the principal and the remedy; context suite gets an owner-only tmp_root (CC-695, refs #778, #782) - #786
Merged
Conversation
…text suite gets an owner-only tmp_root (CC-695, refs #778, #782) #778: the Windows state-root guard said only "a non-owner principal". The PowerShell check now reports the first offending principal and whether the grant is inherited; the guard and `pmctl state status` show it through one helper, and the guard adds a line on PM_DISPATCH_STATE_ROOT and on not editing a parent ACL another tool may need. The guard is not loosened. #782: test-pmctl-context.sh built its state roots under %TEMP%, which inherits CodexSandboxUsers:(M) on a host with the Codex sandbox, so 7 telemetry cases were refused by the guard. It now calls th_secure_state_root on tmp_root, as test-pmctl-gate.sh does. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ESW7P9wHJRbhxx3v7XyQuq
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ESW7P9wHJRbhxx3v7XyQuq
This was referenced Nov 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #778 and #782 (CC-695). #778's third suggestion (a configurable allow list for known sandbox groups) is a security decision and is not done, so #778 stays open for it; #782 is fixed for the 7 telemetry cases it lists.
#778: 守衛的訊息
守衛本身是對的(繼承來的
CodexSandboxUsersModify 確實讓別的主體能寫 run state),不放寬。要改的是訊息:inherited/explicit(UNSAFE|<identity>|<inherited|explicit>,bash 端仍接受單純的UNSAFE)。pmctl state status透過同一個_sw_acl_unsafe_reason顯示:... (ACL grants write to a non-owner principal: BUILTIN\Users, inherited)。PM_DISPATCH_STATE_ROOT指到只有自己能寫的目錄;繼承的授權可能屬於別的工具(例如 Codex 沙箱),不要未經確認就改父目錄。docs/platform-support.md補一條,含icacls建立目錄的做法與不要用PM_DISPATCH_ALLOW_UNSAFE_STATE_ROOT=1的提醒。#782: 測試隔離
test-pmctl-context.sh的 state root 建在%TEMP%底下,繼承CodexSandboxUsers:(M);改為呼叫既有的th_secure_state_root "$tmp_root"(test-pmctl-gate.sh已這樣做),不放寬守衛。驗證(原生 Windows,
%TEMP%實際含CodexSandboxUsers:(OI)(CI)(M))BUILTIN\Users:(M),子目錄繼承):拒絕訊息為... non-owner principal: BUILTIN\Users, inherited,後接補救行。context.queried2、reuse-scan2、pack3(各 filter 的 main 失敗數 2 / 2+1 / 3+2,改後只剩下面列的既有失敗)。test-state-store.sh --filter ACL7 通過;真實 ACL 的四個案例通過,並新增斷言:UNSAFE 時_SW_ACL_OFFENDER以|explicit結尾。test-state-status.sh21 通過 2 略過。real Modify ACE案例失敗。no-arg ... external git repo案例(隔離守衛 exit 99)、marker round-trip reports stale then fresh。整個test-pmctl-context.sh超過 900 秒上限,沒有完整跑。Review (commands/ship.md Step 2.5)
CHANGED: the rejection text for the writer and for pmctl state status is built by one helper (_sw_acl_unsafe_reason); the harness helperth_secure_state_rootwas reused instead of a new ACL setup.state_store_init: Windows ACL write-grant rejectedwas folded to run both PowerShell answers (the bareUNSAFEof before and the named one) and the real-ACL helper_acl_writemask_casegot one assertion on the named principal (criteria 1, 2, 4, 6: the observable contract is the rejection text andrc; no source grep). Both were mutation-tested.🤖 Generated with Claude Code
Review (commands/ship.md Steps 2.5 and 3)
PASS: no warranted refactor/reuse change(the one consolidation,_sw_acl_unsafe_reason, was made earlier; the harness helperth_secure_state_rootis reused).gate-20261105-130216.md(gate-20261105-040137-269c1b),pmctl gate waitverified ittest-state-storeat the same inherited-ACL rejection this PR is about, could not read git metadata (twotest-state-statusrepository-identity assertions failed there; they pass here, 21 passed 2 skipped, and in CI) and hit its 280 s deadline on the inventory suite (the inventory lint itself passed). All of those suites passed natively and in CI. No new test requested.