Repository navigation
test(work-ledger): pin the file fence end to end, document in RFC - #11203
Conversation
…he RFC The `work-ledger` directory leaf is on the sensitive-path floor and the sandbox mask, but the only test was a spelling check against hand-written `~/.kiro/crew/...` paths, and the RFC's security section had no row naming the mechanism. A worker is a full-capability agent with `fs_write`, so the tool layer's writer-ownership rule rests on this fence. - Drive `hooks.on_tool_call` against the real item, binding and conductor files of a dispatched worker under the suite's `KIROCREW_HOME` override: edit and read are both refused, and the worker's route plus the conductor's store action still write the same file. Mutation-verified: commenting out the `work-ledger` leaf turns the edit into `allow`. - RFC §Security considerations: add "A worker edits the ledger files directly", naming both planes (file-tool fence, sandbox mask) and why shell command text is not matched. - RFC Phase 2 exit criteria: add the fence criterion. Closes #9083
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. [DESIGN-REVIEWED] df60456 |
Opus 4.8 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
iamwhatever
left a comment
There was a problem hiding this comment.
Approved after a full read of the diff on the current head: the change matches the linked issue and body, every load-bearing claim was spot-checked against main, tests pin the behaviour, all review lanes are clean and nothing is left undisposed on this head.
…he RFC (kirodotdev#11203) The `work-ledger` directory leaf is on the sensitive-path floor and the sandbox mask, but the only test was a spelling check against hand-written `~/.kiro/crew/...` paths, and the RFC's security section had no row naming the mechanism. A worker is a full-capability agent with `fs_write`, so the tool layer's writer-ownership rule rests on this fence. - Drive `hooks.on_tool_call` against the real item, binding and conductor files of a dispatched worker under the suite's `KIROCREW_HOME` override: edit and read are both refused, and the worker's route plus the conductor's store action still write the same file. Mutation-verified: commenting out the `work-ledger` leaf turns the edit into `allow`. - RFC §Security considerations: add "A worker edits the ledger files directly", naming both planes (file-tool fence, sandbox mask) and why shell command text is not matched. - RFC Phase 2 exit criteria: add the fence criterion. Closes kirodotdev#9083
What
Pins the
<data_home>/work-ledger/**file fence end to end through the tool gate, and documents the mechanism in the conductor work-ledger RFC (a §Security considerations row and a Phase 2 exit criterion).Why
#9083 was deferred from the #8855 design review: a worker is a full-capability agent with
fs_write, so the tool layer's writer-ownership rule (worker ownsstatus/summary/artifacts/pr; conductor ownsacceptance/verdict/state/decision) is only as strong as the file fence under it. A prompt-injected worker that could openitems/it_*.jsondirectly would forgestate: accepted, gutacceptancebefore the conductor's evaluator runs, or read a sibling item pastread_work_brief's scoping.Preflight found that the fence itself already shipped in #9152 (
"work-ledger"is a directory leaf in_CREW_SECRET_LEAVESinsrc/kiro_crew/security/paths.py, and insandbox._CREW_HIDDEN_LEAVES). What the issue asked for and was still missing:is_sensitive_pathon hand-written~/.kiro/crew/...spellings, which never exercises theKIROCREW_HOMEre-anchoring or the store's own writer), andHow
test/test_work_ledger_tools.py: newtest_a_worker_edit_of_its_own_item_file_is_refused_and_the_store_still_writes. Dispatches the two-conductor two-worker fixture, then drivesHookManager.on_tool_callwithtool_kind="edit"on the worker's item file, its binding file and the conductor record, andtool_kind="read"on its own and a sibling's item. Every call isTOOL_DENYwith a sensitive-path reason. It then asserts the sanctioned writers still reach the same file: the worker'swork_reportroute and the conductor'sapply_conductor_action("decide")both land, and the bytes change. The suite'sKIROCREW_HOMEoverride is asserted to be outside~/.kiro/crew, so the test proves the override anchoring, not the default spelling.echo >,python -c) are deliberately not text-matched by the gate (is_sensitive_bash_commandsays why); the OS sandbox mask is the shell-side control and the existing_CREW_HIDDEN_LEAVESassertion covers it. The new test's docstring says so.docs/request-for-change/rfc-conductor-work-ledger.md: §Security considerations gains the row naming both planes (file-tool fence via_CREW_SECRET_LEAVES->_SENSITIVE_HOME_DIRS->is_sensitive_path->hooks.on_tool_call; sandbox mask via_CREW_HIDDEN_LEAVES), why it is read AND write, why it is a directory leaf, and why the store'satomic_writeis unaffected. Phase 2 exit criteria gain the corresponding bullet.No production code changes.
Tests
timeout 900 python3 -m pytest -n0 test/test_work_ledger_tools.py -x -q-> 51 passed."work-ledger"leaf in_CREW_SECRET_LEAVESturns the edit decision intoallowand the new test fails withassert 'allow' == 'deny'; restoring it passes.scripts/check_black_formatting.py(post-commit),scripts/check_comment_history.py: all clean.Other
Backend-only test and docs change, no user-visible UI; labeled
no-screenshots.Co-assignee on the issue is @iamwhatever; no branch or PR from them covered this, so this PR takes the residual items only.
Pattern harvest
Not generalizable: a fence-specific test and RFC row for one directory leaf; the mechanism it pins already exists and is covered generically for the sensitive-path floor.
Closes #9083