# Axis 3 Forbidden Paths — Finalized (Phase 0)

- task_id: task-2652
- chair_authorization_id: `CHAIR-AUTH-AXIS-3-PHASE0-20260524-JJONGS-PRETOOLUSE-AUDIT-001`
- ts: 2026-05-24 KST
- status: **FINALIZED_FOR_CHAIR_SIGNATURE** (★ 실 적용은 별도 live activation chair signature 후)

## 1. 배경

task-2643 hook (`hooks/pre_tool_use_anu_guard.py`)은 현재 **Bash command pattern matching only** (5 그룹). path-based forbidden 차단은 **hook 확장** 또는 **별도 path guard** 필요.

본 spec은 chair signature packet field_07 high_priority_forbidden_list_template 7 entry를 기준 baseline 으로 확정하고, hook 확장 시 path-based check 진입점을 명시한다.

## 2. 확정 forbidden path 8 entry

| # | path glob | 의도 | 위반 시 action |
|---|---|---|---|
| 1 | `/home/jay/.env` · `/home/jay/.env.*` | credential 파일 직접 read/write 차단 | BLOCK |
| 2 | `**/.env.keys` · `**/.env.local` · `**/.env.production` | 프로젝트 내 credential keys 차단 | BLOCK |
| 3 | `/home/jay/.claude/settings.local.json` | claude-code local secrets 차단 | BLOCK |
| 4 | `/home/jay/.claude/settings.json` | live PreToolUse 임의 변경 차단 (★ Axis 3 본인 활성화 시 chair signature 후 별도 procedure 만 허용) | BLOCK (chair signature manual bypass) |
| 5 | `/usr/local/bin/cokacdir` · `/usr/local/bin/cokacdir-*` | live infra binary 변경 차단 | BLOCK |
| 6 | `.github/**` · `/home/jay/workspace/.github/**` | CI workflow / Actions config 임의 변경 차단 | BLOCK |
| 7 | `**/credentials*` · `**/*credentials.json` · `**/credentials.yaml` | credential 파일 일괄 차단 | BLOCK |
| 8 | `/home/jay/.ssh/**` · `/home/jay/.gnupg/**` | ssh / gpg key 직접 접근 차단 | BLOCK |

## 3. tool별 적용 매트릭스

| tool | path check 위치 | 적용 |
|---|---|---|
| Read | `tool_input.file_path` | 모든 entry 적용 |
| Write | `tool_input.file_path` | 모든 entry 적용 |
| Edit | `tool_input.file_path` | 모든 entry 적용 |
| NotebookEdit | `tool_input.notebook_path` | 모든 entry 적용 |
| Bash | `tool_input.command` 안의 path token | 정규식 추출 후 일치 시 BLOCK (false positive 위험 → WARN 우선 검토) |
| Glob/Grep | `path`/`pattern` | 응답 dump 자체는 차단 안 함 (단 dump 대상 디렉토리만 audit log) |

## 4. hook 확장 진입점 (★ live activation task 에서 구현 대상)

현재 `hooks/pre_tool_use_anu_guard.py:evaluate_tool_call` 에 다음 분기 추가 필요:

```python
TOOLS_WITH_PATH = {"Read", "Write", "Edit", "NotebookEdit"}
if tool_name in TOOLS_WITH_PATH:
    path = tool_input.get("file_path") or tool_input.get("notebook_path") or ""
    if _matches_forbidden_path(path):
        return {"decision": "deny", "reason": "FORBIDDEN_PATH_ACCESS", "match_path": path, ...}
```

`_matches_forbidden_path` 는 본 spec 의 8 glob entry 를 `fnmatch.fnmatch` 로 매칭한다.

## 5. allowed exception (chair signature manual bypass)

- `/home/jay/.claude/settings.json` 자체 변경은 **Axis 3 live activation chair signature 절차 안에서만** 허용. 일반 ANU 작업은 차단.
- bypass 시그널: ENV `CLAUDE_PRE_TOOL_USE_HOOK_BYPASS_AT_PATH=<verbatim_chair_authorization_id>` 가 정확히 일치할 때만 settings.json write 허용 (★ live activation task에서 구현 결정)

## 6. false positive 보호

- BLOCK 결정 시 `allowed_alternative` 필드에 우회 절차 명시 (현재 hook 의 `delegated_watcher_contract` 와 동일 형식 유지)
- audit log: `~/.claude/data/pre_tool_use_audit.jsonl` (live activation 시 wire up · 본 Phase 0 범위 외)

## 7. forbidden path entry 후속 검증 항목 (★ live activation task)

- [ ] 8 path entry × 각각 Read/Write/Edit positive case fixture
- [ ] 정상 작업 (`/home/jay/workspace/memory/**`, `/home/jay/workspace/utils/**`) 통과 negative case fixture
- [ ] settings.json bypass ENV 동작 검증
- [ ] audit log 형식 검증

## 8. chair packet 정합

- chair signature packet field_07.high_priority_forbidden_list_template 6 entry 모두 포함 ✓
- 추가 entry 2개: `/home/jay/.claude/settings.json` (live PreToolUse 자기 보호) + `**/.env.keys` 변형 (현실 운영 credential)
- forbidden_action_count = 0 (본 spec 작성 단계에서 실행 0)

끝
