fix(s03): let Gate 2 own the workspace boundary instead of safe_path

safe_path hard-raised on out-of-workspace paths while Gate 2 asked about the same condition, so approving an out-of-workspace write never took effect. Make the permission pipeline the sole boundary authority: drop safe_path, resolve paths directly in the file tools, and extend the Gate 2 rule to read_file. Sync all three READMEs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Viper
2026-07-27 20:27:22 +08:00
committed by root
parent a9cafe953a
commit 4d8d420e41
4 changed files with 11 additions and 18 deletions

View File

@@ -28,7 +28,7 @@ s02 のループは完全に維持される。唯一の変更は、ツール実
| ゲート | 役割 | 一致時 |
|--------|------|--------|
| 1. 拒否リスト | 常に禁止される操作(`rm -rf /``sudo` | 即座に拒否、実行しない |
| 2. ルールマッチング | コンテキスト依存の操作(作業ディレクトリ外への書き込み`rm` ファイル) | ゲート 3 へ |
| 2. ルールマッチング | コンテキスト依存の操作(作業ディレクトリ外への読み書き、`rm` ファイル) | ゲート 3 へ |
| 3. ユーザー承認 | ゲート 2 が一致した場合、ユーザー確認を待機 | ユーザーが許可または拒否を決定 |
3 つのゲートのどれにも一致しない → 直接実行。日常の操作の大部分はこの経路を通る。
@@ -59,7 +59,7 @@ def check_deny_list(command: str) -> str | None:
```python
PERMISSION_RULES = [
{
"tools": ["write_file", "edit_file"],
"tools": ["read_file", "write_file", "edit_file"],
"check": lambda args: not (WORKDIR / args.get("path", "")).resolve().is_relative_to(WORKDIR),
"message": "Writing outside workspace",
},