From b56614c814b904c224315a11f9686f0d47abd3d3 Mon Sep 17 00:00:00 2001 From: tanaka takashi Date: Wed, 12 Aug 2026 05:44:54 +0900 Subject: feat: revise sandbox usability around semantic policy and LPAC process trees Rewrite the specification and design vocabulary around User Sandbox Configuration, Environment Resolution, Executable Approval, Effective Sandbox Policy, and Windows Enforcement. Move the Internal Tool catalog to the design without treating its count as a requirement, and update README, implementation planning, traceability, audit history, prompts, and the Python skill. Introduce schema_version 1 profiles, workspaces, mounts, executable aliases, network modes, and resource presets. Add local override merging, resolution and approval stores with atomic user-only persistence, fail-closed fingerprints, localized diagnostics, and executable/sandbox management CLI commands. Change Windows execution to LPAC entry approval with inherited descendant confinement. Separate read and execute ACLs, preserve protected OS DACLs, apply Job process/memory/timeout limits to the tree, enforce WFP network modes, prevent credential environment inheritance, disable out-of-tree MSBuild reuse, and harden transactional ACL/recovery cleanup. Isolate planning prompts from execution instructions, reject split coding plans that cannot satisfy task-scoped evidence, preserve configured thinking, and prevent optional task_update failures from corrupting completion checks. Add and update configuration, resolution, approval, LPAC, descendant, readonly/development, Registry/COM, WFP, recovery, .NET/Python/PowerShell process-tree, and Operational E2E coverage. Publish reproducible bundles while preserving deployment-local configuration, prompts, skills, logs, state, approvals, and resolutions. --- plans/ImplementationPlan.md | 86 +++++++++++++++++++--------------------- plans/RequirementTraceability.md | 34 ++++++++-------- plans/progress/Phase6.md | 1 + 3 files changed, 59 insertions(+), 62 deletions(-) (limited to 'plans') diff --git a/plans/ImplementationPlan.md b/plans/ImplementationPlan.md index b9cda6d..c2c348e 100644 --- a/plans/ImplementationPlan.md +++ b/plans/ImplementationPlan.md @@ -115,10 +115,10 @@ | 2 | MCP Public Interface | stdio、非同期Task受付、`agent_run/status` | G2 | | 3 | Session / Ollama / Prompt | text会話、Session、token usage、Prompt優先順位 | G3 | | 4 | Token Planner | TaskGraph、Token PERT/CPM、再計画 | G4 | -| 5 | Internal Tool / Policy Boundary | Design.mdのTool catalog、ToolUseGuard、Policy Engine | G5 | +| 5 | Internal Tool / Policy Boundary | Design.mdのInternal Tool catalog、ToolUseGuard、Policy Engine | G5 | | 6 | Filesystem / Process Sandbox | AppContainer、ACL、Job、hash approval | G6 | | 7 | Transaction / Recovery | ACL Resource Transaction、File rollback、Recovery Journal | G7 | -| 8 | Network Sandbox | WFP deny / host-port allow-list | G8 | +| 8 | Network Sandbox | WFP none / local / restricted | G8 | | 9 | Vision / Streamable HTTP | optional画像、loopback HTTP | G9 | | 10 | Audit / Security Hardening | Audit JSONL、全Security Matrix | G10 | | 11 | Acceptance / Release Audit | AT全件、文書整合、未完了ゼロ確認 | G11 | @@ -327,25 +327,25 @@ Planner deterministic test全PASS。 - OLL-10〜11 - SEC-INV-01〜02 ## 10.2 Internal Tool catalog -| Tool | Operation | +| Internal Tool | Operation | | --- | --- | | `file_search` | glob / name / text / regex / tail | | `file_read` | whole / range / metadata | | `file_edit` | overwrite / patch / atomic_replace / delete | -| `process_run` | exe + args + cwd + timeout | +| `process_run` | Executable + args + cwd + timeout | | `task_update` | add / dependency / estimate | -個々の `grep`、`find`、`tail` 等を独立Toolにしない。 +個々の `grep.exe`、`find.exe`、`tail.exe` 等を独立Internal Toolにしない。 ## 10.3 実装対象 - JSON Schema - Ollama native tool calling - Internal Tool Dispatcher - Policy Engine I/F -- Tool argument validation +- Internal Tool argument validation - ToolUseGuard - `requires_external_effect` — **Planning フェーズで LLM structured output により Task ごとに判定・設定**(keyword heuristic 廃止) - same failure fingerprint limit=5 - Plan/Run フェーズ分離: PlanAsync (structured output) → RunAsync (ready Task 順次実行) -- replan: Policy deny 時に最大3回まで再計画可能 +- replan: Effective Sandbox Policy deny時に最大3回まで再計画可能 - Context Summary: `prompt_eval_count / num_ctx` ≥ 80% で古い Conversation/ExecutionResult を compact ## 10.4 重要な段階制約 このPhaseの副作用backendはfake/in-memory実装を使用可能とし、Windows sandboxを迂回した本物の無制限file/process操作を実装してはならない。 @@ -353,13 +353,13 @@ Planner deterministic test全PASS。 - [ ] MCP ClientからInternal Toolが見えない - [ ] OllamaにはDesign.md 7章のcatalogだけを公開 - [ ] malformed tool args拒否 -- [ ] Policy deny時に副作用なし -- [ ] Policy denyは同一Tool呼出しへ再投入せず、許可済み能力内の条件付き再計画を最大3回行い、同一deny・計画未変更・実行可能Taskなし・再計画失敗でfailedとなる +- [ ] Effective Sandbox Policy deny時に副作用なし +- [ ] Effective Sandbox Policy denyは同一Internal Tool Callへ再投入せず、許可済みcapability内の条件付き再計画を最大3回行い、同一deny・計画未変更・実行可能Taskなし・再計画失敗でfailedとなる - [ ] external effect必須Taskでtool未使用ならcompletedにならない - [ ] 同一失敗5回でfailed - [ ] pure analysis TaskにはToolを強制しない ### Gate G5 -LLM→Tool→Policyの境界が固定され、Policyを通らない副作用経路が存在しないこと。 +LLM→Internal Tool Call→Policy Engineの境界が固定され、Effective Sandbox Policyを通らない副作用経路が存在しないこと。 --- # 11. Phase 6 — Filesystem / Process Sandbox ## 11.1 対応仕様 @@ -367,39 +367,36 @@ LLM→Tool→Policyの境界が固定され、Policyを通らない副作用経 - SEC-INV-03〜05、08 - ST-01〜11、ST-16 ## 11.2 実装対象 -- Application固定AppContainer Profile -- Sandbox Broker -- FilesystemPolicy R/W/E/Delete -- canonical path -- reparse point防御 -- NTFS ACL(承認directory rootへの継承ACE、root単位snapshot、protected descendantのfail-safe維持) -- Process approval canonical path + SHA-256 -- shell toggle -- Job Object -- descendant制御 -- process count / memory limit -- KILL_ON_JOB_CLOSE +- Application固定LPAC Profileと`ALL APPLICATION PACKAGES` opt-out +- User Sandbox ConfigurationからEffective Sandbox Policyへの変換 +- Logical Pathのreparse chain解決、config別Resolution Store、変更時fail-closed +- Workspace/Mount/Runtime/Artifact/OS RuntimeのFilesystem capability +- NTFS ACL(readとexecuteを分離した継承ACE、root単位snapshot、protected descendantのfail-safe維持) +- Executable Alias、Approved Entry ExecutableのResolved Path + SHA-256、user-local Approval Store +- Runtime Component/development Workspace Artifact/External Unknown Entryの分類 +- Entry ProcessとDescendant ProcessへLPAC、ACL、WFP、Job Objectを継承 +- breakaway禁止、process count / memory limit / timeout / KILL_ON_JOB_CLOSE - Named Pipeが必要ならtask固有DACL -## 11.3 Process approval -承認条件は以下を両方満たすこと。 +## 11.3 Executable Approval +BrokerがApproved Entry ExecutableまたはApproved Shell Executableを直接起動する条件は以下をすべて満たすこと。 ```text -canonical path == approval.path -SHA-256 == approval.sha256 +Alias == approval.alias +Resolved Path == approval.resolved_path +SHA-256 == approval.sha256 ``` -hash変更、path変更は再承認を必要とする。 +hash、Logical Path、Resolved Pathの変更は再承認を必要とする。Descendant Processには個別Approvalを要求せず、Sandbox Process Treeのconfinementで制御する。 ## 11.4 必須Security Test -- [ ] ST-01 read許可成功 -- [ ] ST-02 read未許可拒否 -- [ ] ST-03 write許可成功 -- [ ] ST-04 delete権限なし拒否 -- [ ] ST-05 junction脱出拒否 -- [ ] ST-06 symlink chain脱出拒否 -- [ ] ST-07 approved exe成功 -- [ ] ST-08 hash mismatch拒否 -- [ ] ST-09 shell disabled拒否 -- [ ] ST-10 descendant未承認exe拒否 -- [ ] ST-11 Job closeで全descendant終了 -- [ ] ST-16 Ollama tool path脱出拒否 +- [ ] readonly Workspaceでread成功、write/delete/Artifact Entry拒否 +- [ ] development Workspaceでread/write/delete/Artifact Entry成功 +- [ ] Mount accessとEntry起動禁止 +- [ ] reparse chain/cycle、Resolution変更、fingerprint変更をfail-closed +- [ ] Approved EntryのAlias/Resolved Path/hash一致、stale hash拒否 +- [ ] Runtime Component、Workspace Artifact、OS Runtime、External Unknown Entryの分類 +- [ ] Entry/Descendant tokenが同じLPAC identityでJob chain内に残る +- [ ] Approved Python→Python subprocess、Approved PowerShell→cmd、Approved .NET→build/testが成功 +- [ ] breakaway、未許可Filesystem、Registry write、COM、Networkを拒否 +- [ ] Job close/cancel/timeoutで全Descendant終了 +- [ ] Ollama Internal Tool CallのResolved Path脱出拒否 ## 11.5 監査証跡 Security testでは「例外になった」だけでなく、OS/Brokerで実際に対象資源へ副作用が発生していない証跡を残す。 ### Gate G6 @@ -460,7 +457,7 @@ mode=deny mode=allow -> default deny - -> allow-list hostをTask開始時にDNS resolve + -> restricted endpoint hostをTask開始時にDNS resolveしてIP snapshot化 -> IP snapshot + portだけallow ``` ## 13.3 実装時にCodexが選択してよい範囲 @@ -565,12 +562,11 @@ AT-01〜AT-20をすべて再実行する。 ## 16.2.1 Release Bundle - `dotnet publish -c Release -r win-x64 --self-contained true` を実行する。 - `agent-mcp.exe`、runtime/dependency、`agent.yaml`、en/ja locale、User Prompt、`skills/`、READMEを含むversion付きZIP、manifest、SHA-256を生成する。 -- ソースツリー外の空directoryへ展開し、Bundle内の資源だけで `agent-mcp check`、stdio initialize、loopback HTTP起動を実行する。 +- ソースツリー外の空directoryへ展開し、Bundle内の資源だけで`agent-mcp sandbox resolve`まで実行する。`check`、stdio、HTTPは、利用者がResolutionを確認し必要なExecutableを承認したOperational配置で実行する。 ## 16.2.2 Operational E2E Test -- E2E-01: Release Bundle、local Ollama、実測approval、stdio MCP Clientでfixtureのread/edit/process/build/test、日本語応答、Audit追跡、cleanupまで完走する。 -- E2E-02: 同等の作業をloopback Streamable HTTPで完走し、Legacy SSE、GET SSE、non-loopback bindが存在しないことを確認する。 -- Cloud model試験は任意互換試験とし、Release Gateへ含めない。 +- E2E-01: Release Bundle、`deepseek-v4-flash:cloud`、Python 3.14の実測Approval、stdio MCP Clientで一時fixtureへ複雑なPython programとtestを作成し、Python subprocessを含むtest、日本語応答、Audit追跡、cleanupまで完走する。 +- E2E-02: 同等の作業をloopback Streamable HTTPのIPv4/IPv6で完走し、Legacy SSE、GET SSE、non-loopback bindが存在しないことを確認する。 ## 16.3 Requirement Traceability監査 最低限次のマトリクスを完成させる。 | Requirement | Implementation | Test | Result | Evidence | @@ -622,7 +618,7 @@ AT-01〜AT-20をすべて再実行する。 9. 仕様・設計逸脱0、または承認済み文書更新済み 10. Recovery後のclean state確認 11. publish済みwin-x64 self-contained Release Bundleが単独で起動可能 -12. E2E-01 / E2E-02がlocal OllamaでPASS +12. E2E-01 / E2E-02が配布既定の`deepseek-v4-flash:cloud`とPython 3.14でPASS 13. READMEだけでfresh directoryから初回セットアップ可能 --- # 17. フェーズ横断テスト分類 diff --git a/plans/RequirementTraceability.md b/plans/RequirementTraceability.md index 6025755..4f901e6 100644 --- a/plans/RequirementTraceability.md +++ b/plans/RequirementTraceability.md @@ -1,8 +1,8 @@ # Requirement Traceability -現行実装の検証対象はcommit `37386b8`(2026-08-11 JST)である。2026-08-09を含む過去の結果は`plans/progress/`に履歴として保持するが、現行PASS判定には使用しない。 +Sandbox Usability Revision後の現行実装を対象とする。commit `37386b8`(2026-08-11 JST)以前の結果は`plans/progress/`と本書末尾に履歴として保持するが、現行PASS判定には使用しない。 -状態は`PASS / PARTIAL / FAIL / NOT REVERIFIED`を使う。現在、Requirement mapping、Acceptance Tests、Security Testsに未説明の`PARTIAL / FAIL / NOT REVERIFIED`はない。 +状態は`PASS / PARTIAL / FAIL / NOT REVERIFIED`を使う。2026-08-12の現行working-tree管理者証跡は`artifacts/evidence/sandbox-usability-final-working-tree-2/`に保存する。 ## Requirement mapping @@ -15,11 +15,11 @@ | AGT-01〜06 | `AgentRuntime`, `InternalToolDispatcher`, MCP公開境界 | completion/replan/iteration/catalog tests、stdio/HTTP E2E | PASS | | PLN-01〜06 | `TaskGraph`, `PlannerService`, structural `task_update` | Planner 10件、structured-plan retry、Task固有Tool証跡test | PASS | | SES-01〜06 | `SessionStore`、会話/graph/result保持、structured要約 | summary成功/失敗、session/runtime tests | PASS | -| FS-01〜07 | `PathPolicy`, `TaskAclManager`, `WindowsToolBackend` | Elevated Windows Security/Recovery 42件、Operational E2E | PASS | -| PRC-01〜07 | `ExecutablePolicy`, `RestrictedProcessLauncher`, Job/child restriction | Elevated Windows suite、in-process build/self-test E2E | PASS | +| FS-01〜10 | `ResolvedPath`, `PathPolicy`, `TaskAclManager`, `SandboxEnvironmentResolver` | Resolution/fingerprint/nested root、read/execute分離、readonly/development LPAC実効果、管理者suite | PASS | +| PRC-01〜09 | `EntryExecutablePolicy`, `RestrictedProcessLauncher`, Approval Store、Job Process Tree | Alias-only Entry、hash、Runtime/Artifact分類、Entry/Descendant LPAC SID・Job、PowerShell/Python/.NET build/test、breakaway、process/memory/timeout | PASS | | REC-01〜07 | retry、timeout、cancel cleanup、`RecoveryManager` | Core lifecycle、elevated crash/recovery matrix、残留0 | PASS | -| SEC-INV-01〜05 | deny-by-default、Policy非変更、path/hash/descendant制約 | Core境界、elevated Windows suite、E2E | PASS | -| SEC-INV-06〜08 | WFP allow/deny、credential非継承 | elevated WFP/security tests、Bundle check、E2E | PASS | +| SEC-INV-01〜05 | deny-by-default、Policy非変更、Resolved Path/hash/Entry分類 | Core境界、管理者Windows suite、Operational E2E | PASS | +| SEC-INV-06〜08、13 | WFP none/local/restricted、credential非継承、Process Tree confinement | credential非継承、全Network mode、Process Tree実効果 | PASS | | SEC-INV-09 | Fixed Prompt precedence | prompt tests | PASS | | SEC-INV-10〜11 | cleanup、Recovery gate | Core cleanup、elevated recovery tests、全E2E後残留0 | PASS | | SEC-INV-12 | stdio stdout purity | MCP stdio integration、Operational stdio E2E | PASS | @@ -33,7 +33,7 @@ | ID | Current implementation / test | Status | |---|---|---| | AT-01〜06 | MCP stdio/HTTP、公開schema、Task lifecycle、Ollama、Vision拒否 | PASS | -| AT-07〜13 | Windows backend、reparse、process、WFP、crash recovery | PASS | +| AT-07〜13、21〜22 | Resolution、LPAC/ACL/Process Tree、WFP、crash recovery | PASS | | AT-14〜17 | cycle、immutable、PERT/CPM、全phase token集計 | PASS | | AT-18〜20 | en/ja、追加locale、malformed/unknown locale | PASS | @@ -41,8 +41,8 @@ | ID | Current implementation / test | Status | |---|---|---| -| ST-01〜09 | capability/path/reparse/hash/shell、ACL/AppContainer実効果 | PASS | -| ST-10〜14 | child restriction、Job timeout、WFP actual traffic | PASS | +| ST-01〜09 | Profile/Mount/Resolution/Approval、ACL/LPAC実効果 | PASS | +| ST-10〜14 | Descendant inheritance、Job timeout、WFP actual traffic | PASS | | ST-15〜16 | MCP非公開境界、Design Tool catalogの名前/schema/Policy境界 | PASS | | ST-17〜18 | ACL/WFP/loopback crash recovery | PASS | | ST-19〜20 | malformed locale fatal、non-loopback bind拒否 | PASS | @@ -53,14 +53,14 @@ Internal Tool testは件数を仕様としてassertしない。`Design.md`のToo | Verification | Date / privilege | Result | |---|---|---| -| Release build | 2026-08-11 / non-elevated / Release | warning 0、error 0 | -| Agent.Core.Tests | 2026-08-11 / administrator suite | 82 PASS、0 FAIL、0 skip | -| Agent.Planner.Tests | 2026-08-11 / administrator suite | 10 PASS、0 FAIL、0 skip | -| Agent.Windows.Tests | 2026-08-11 / administrator | 42 PASS、0 FAIL、0 skip。Security/Recovery/crash matrixを含む | -| win-x64 self-contained Bundle | 2026-08-11 / publish後administrator check | directory/ZIP/checksum生成、local override非同梱、runtime check PASS。ZIP SHA-256 `8ccc538557dcb96cc95ecae7b1858de3544997b16a5675aacb05a03f539829b1` | -| Operational E2E | 2026-08-11 / administrator / `deepseek-v4-flash:cloud` | stdio、HTTP IPv4、HTTP IPv6すべてPASS。read/edit/build/self-test、ACL/WFP/temp cleanup確認 | -| Task Resource repository state | 2026-08-11 | `state/journals`, `state/backups`, `state/mcp-tasks`はいずれも不存在 | +| Release build | 2026-08-12 / non-elevated | warning 0、error 0 | +| Agent.Core.Tests | 2026-08-12 / administrator | 103 PASS、0 FAIL、0 skip | +| Agent.Planner.Tests | 2026-08-12 / administrator | 10 PASS、0 FAIL、0 skip | +| Agent.Windows.Tests | 2026-08-12 / administrator | 53 PASS、0 FAIL、0 skip。LPAC/ACL/Job/WFP/Recovery、PowerShell/Python/.NET Process Treeを含む | +| win-x64 self-contained Bundle | 2026-08-12 / administrator / fresh展開 | check PASS。既定ZIPにlocal override・local prompt/Skill・固有pathなし。deployment local資産保持。ZIP SHA-256 `f220cbf66d6d2bfd110542cdeec48cd64c97aec549b4ffd999c4746f3324ecb0` | +| Operational E2E | 2026-08-12 / administrator / `deepseek-v4-flash:cloud`, `think:true`, Python 3.14.3 | stdio、HTTP IPv4、HTTP IPv6すべてPASS。Python実装、子Python unittest、独立検証、ACL/WFP/temp cleanup確認 | +| Task Resource residual state | 2026-08-12 / administrator | Journal 0、backup 0、published `agent-mcp` process 0 | | MCP 2026-07-28 conformance runner 0.2.0-alpha.11 | 2026-08-11 / loopback HTTP | application failure 0。適用可能checkはPASS。production fixture非公開とWindows runner終了不具合はrunner limitation 9件として非PASSのまま分離 | | MCP Tasks conformance runner | 2026-08-11 / loopback HTTP | application failure 0。runner専用fixture不足による未実施27件をrunner limitationとして非PASSのまま分離 | -証跡は`artifacts/evidence/final-37386b8/`に生成した。conformanceのrunner limitationはRequirement PASSの根拠に使用しておらず、対応する製品機能はCore/MCP integration、Windows suite、Operational E2Eで検証した。 +conformance runnerの行はcommit `37386b8`の履歴であり、旧証跡は`artifacts/evidence/final-37386b8/`に保持する。現行ReleaseのSecurity/Operational証跡は上記2026-08-12記録を正本とする。 diff --git a/plans/progress/Phase6.md b/plans/progress/Phase6.md index fdfd175..03a6120 100644 --- a/plans/progress/Phase6.md +++ b/plans/progress/Phase6.md @@ -1,6 +1,7 @@ # Phase 6 Progress > Historical evidence: この記録は作成当時のcommitに対する結果であり、現行commitの再監査結果ではない。 +> Sandbox Usability Revisionでchild-process restriction、path/hash設定、shell toggleはLPAC Process Tree、Executable Alias/Approval Store、semantic Execution設定へ置換された。本記録は新設計の受入証跡には使用しない。 - 実装: fixed AppContainer、canonical/reparse policy、能力別ACL、path+SHA-256、Job Object、`PROCESS_CREATION_CHILD_PROCESS_RESTRICTED`、Broker launch。 - 実測: approved PowerShellからの `Start-Process`、Process API、shell、rename/copyの4経路を試し、全unbrokered childをOS restrictionで拒否した。markerなし、Job process不変、非zero親結果、Audit `policy.deny`を確認した。 -- cgit v1.2.3