Skip to content
Back to skills

1638 Plan 4e054b00

ASecurity

When an appfix session navigates to a new directory (not under origin_project), auto-approval stops working because `_is_cwd_under_origin()` returns False.

  • 9 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 31, 2026
developmentrustgo

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned May 31, 2026

npx -y skills add tools-only/X-Skills --skill 1638-plan_4e054b00 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 1638 Plan 4e054b00?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 1638 Plan 4e054b00
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-1638-plan-4e054b00/badge)](https://www.skillsdirectory.com/skills/tools-only-1638-plan-4e054b00)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# Fix: Plan Auto-Approval Bug for Cross-Directory Sessions

## Bug Summary
When an appfix session navigates to a new directory (not under origin_project), auto-approval stops working because `_is_cwd_under_origin()` returns False.

## Root Cause
`_is_cwd_under_origin()` only checks if cwd is under origin_project. It doesn't consider that the SAME SESSION should be trusted regardless of directory.

## The Minimal Fix (3 changes in 1 file)

### File: `config/hooks/_common.py`

**Change 1**: Add `session_id` parameter to `_is_cwd_under_origin()` (lines 221-248)
- If session_id matches user_state's session_id, return True (trust same session)
- Otherwise fall back to existing directory check

**Change 2**: Add `session_id` parameter to functions that call `_is_cwd_under_origin()`:
- `is_appfix_active(cwd, session_id="")` - line 251
- `is_mobileappfix_active(cwd, session_id="")` - line 285
- `is_godo_active(cwd, session_id="")` - line 318
- `is_autonomous_mode_active(cwd, session_id="")` - line 352
- `get_autonomous_state(cwd, session_id="")` - line 451

**Change 3**: Update hook callers to pass session_id:
- `pretooluse-auto-approve.py` - extract session_id from input_data, pass to functions
- `permissionrequest-auto-approve.py` - same pattern

## Why This Is Safe
- Session matching is cryptographically strong (session IDs are unique)
- Only the same session can use its own state across directories
- Different sessions still get the directory check (safety preserved)

## Test Plan
1. Start appfix in project A
2. Navigate to unrelated directory /tmp/test-dir
3. Verify auto-approval still works (session_id matches)
4. Start new session in project B
5. Verify project A's state doesn't affect project B (session_id mismatch)

Files in this skill

  • README.md964 B
  • skill.md1.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.