planning-with-files
- Type
- Plugin
- Scanned
- Nov 17, 2026
- Version
- 51bf62def62d
- Files read
- 778
This plugin...
Findings
-
CriticalWindows Codex hook launcher executes py or python binaries from the untrusted project directory
On Windows, the Codex plugin and workspace hooks run .codex/hooks/pwf-hook.cmd with the current repository as the working directory. Unless PYTHON_BIN is manually set, pwf-hook.cmd sets PY_EXE to the bare name py or python and invokes it via cmd.exe, which searches the current working directory before PATH. Opening Codex in a cloned repository that contains a malicious py.cmd, py.bat, py.exe, or python.cmd in its root immediately executes that file on SessionStart without user or AI approval, and also omits Python's -I isolated mode flag.
Fix: Resolve Python to a verified absolute path outside the current working directory (for example using where.exe with explicit PATH directories only), quote the full path, and pass the -I flag to Python.
-
HighStop gate follows symlinks on state files to overwrite arbitrary user files
When a turn ends, the Stop hook runs check-complete.sh --gate (and check-complete.ps1 or Hermes evaluate_gate). If an untrusted cloned repository contains a .mode file with the word gate, a task_plan.md with an in_progress phase, and symlinks at .stop_blocks or .gate_last_ledger pointing to files outside the repo (such as ~/.ssh/authorized_keys, ~/.bashrc, or ~/.claude/settings.json), the script follows those symlinks and overwrites the target files with counter digits as soon as the agent finishes any reply, with no AI tool call involved.
Fix: Verify that .stop_blocks and .gate_last_ledger are regular, single-link files within the canonical project root before reading or writing, and update them via exclusive temporary files in the verified directory followed by atomic rename.
-
HighStop-gate hooks follow symlinks on .stop_blocks and .gate_last_ledger to overwrite arbitrary files
.opencode/packages/opencode-planning-with-files/src/core.ts:561
When a plan enables gated mode (.mode containing 'gate') and has an in-progress phase, the automatic turn-stop hook writes block counters to .stop_blocks and .gate_last_ledger inside the plan directory without checking whether those paths are symlinks or hardlinks. If a user opens a cloned repository containing a gated task_plan.md and a symlink at .stop_blocks or .gate_last_ledger pointing to a file outside the project (such as ~/.zshrc or ~/.ssh/authorized_keys), finishing a single benign turn overwrites the target file with '1'. In the OpenCode and DeepSeek Harness plugins (.dsh/packages/dsh-planning-with-files/src/core.ts), readCounter() also returns 0 whenever .stop_blocks is a symlink, which defeats the 20-block cap and causes an unbounded auto-continue loop. The same symlink overwrite affects check-complete.sh and check-complete.ps1 across the skill mirrors.
Fix: Refuse to read or write .stop_blocks and .gate_last_ledger if lstat shows a symlink or hardlink, verify containment within the project root, and write via an exclusive temporary file and atomic rename.
-
HighPi extension runs uv run in the workspace on session_start before plan approval
.pi/skills/planning-with-files/extensions/planning-with-files/runtime.ts:191
On every session_start event—before the user runs /plan-execute and even when no task_plan.md exists—the Pi extension calls runSessionCatchup(anchorCwd(ctx)), which spawns uv run <CATCHUP_SCRIPT> --no-history <cwd> with cwd set to the workspace directory. Because session-catchup.py has no PEP 723 inline metadata and --no-project is not passed, uv discovers pyproject.toml and uv.toml in the current repository and builds the project environment, allowing a malicious build-backend in a cloned repository to execute arbitrary code on startup for a catchup call that is otherwise a no-op.
Fix: Remove the no-op --no-history subprocess call on session_start, or invoke Python with -I directly and pass --no-project --no-config --isolated if uv is used.
-
HighMastra Code hooks follow symlinks outside the project and bypass attestation and framing
Unlike the hardened inject-plan.sh dispatcher used by Claude Code and Qoder, .mastracode/hooks.json directly runs head -50 task_plan.md, tail -20 progress.md, and cat task_plan.md | head -30. Because POSIX [ -f ], cat, head, and tail follow symlinks without checking root containment, a cloned repository with task_plan.md or progress.md symlinked to sensitive local files (such as SSH keys or cloud credentials) will automatically inject those secrets into the LLM prompt and send them to the model provider. It also skips SHA-256 tamper attestation, DATA ONLY nonce delimiters, and PLANNING_DISABLED=1.
Fix: Dispatch Mastra Code UserPromptSubmit and PreToolUse hooks through the hardened inject-plan.sh script instead of raw cat, head, and tail commands.
-
MediumGemini and Copilot session hooks execute helper scripts from the untrusted project folder
.gemini/hooks/session-start.sh:13
Unlike the Claude Code and Codex hooks, which resolve helper scripts relative to the installed plugin or hook directory, .gemini/hooks/session-start.sh and .gemini/hooks/session-end.sh resolve SCRIPT_DIR inside GEMINI_PROJECT_DIR (or the current working directory), and .github/hooks/scripts/session-start.sh and .ps1 resolve SKILL_DIR from the current working directory. If a user configures these hooks globally in their user settings and opens an untrusted repository containing task_plan.md and a malicious .gemini/skills/planning-with-files/scripts/session-catchup.py or check-complete.sh, the hook immediately executes the attacker's code on session start or end.
Fix: Resolve SCRIPT_DIR and SKILL_DIR relative to the hook script's own path ($0 or $PSScriptRoot) or a trusted user installation path, never from GEMINI_PROJECT_DIR or the current working directory.
-
MediumHermes completion-check tool falls back to executing scripts from the untrusted workspace
.hermes/plugins/planning-with-files/paths.py:105
When the Hermes plugin cannot find skill assets next to the plugin directory (for example, when the user installed the Hermes plugin without separately installing the skill into ~/.hermes/skills/planning-with-files, or installed the skill into ~/.agents/skills via npx skills add), resolve_skill_dir and find_skill_dir walk the active project_dir and Path.cwd() looking for templates/ and scripts/check-complete.sh. Calling the read-only planning_with_files_check_complete tool in an untrusted repository that contains those files causes tools.py to execute the repository's scripts/check-complete.sh via sh.
Fix: Restrict resolve_skill_dir and find_skill_dir to trusted plugin and user-home skill directories (matching plugin_skill_dir), and use _python_completion_report instead of running workspace shell scripts.
-
MediumCursor, Gemini, and Copilot hooks follow symlinks to leak local files into model context and skip attestation
.cursor/hooks/user-prompt-submit.sh:65
While the Claude Code and Codex injectors open planning files with O_NOFOLLOW, verify workspace containment, enforce SHA-256 attestation, and wrap data in nonce delimiters, .cursor/hooks/user-prompt-submit.sh and .ps1 (also invoked by session-start.sh and .ps1), .gemini/hooks/before-agent.sh, and .github/hooks/scripts/session-start.sh and .ps1 read task_plan.md (and progress.md in Cursor) directly with head, tail, or Get-Content. If an untrusted repository contains symlinks such as task_plan.md pointing to ~/.aws/credentials or ~/.ssh/id_ed25519, opening the project or sending a prompt automatically injects the user's private files into the AI context sent to the model provider. These hooks also ignore .plan-attestation and omit BEGIN/END data framing despite .gemini/skills/planning-with-files/SKILL.md stating both are enforced.
Fix: Delegate context reading in the Cursor, Gemini, and Copilot hooks to scripts/inject-plan.sh or scripts/inject-plan.py so symlink rejection, workspace containment, attestation verification, and nonce framing are enforced uniformly.
-
MediumStop completion gate ignores plan hash attestation and injects unframed phase headings
SKILL.md states that autonomous and gated modes require an attested plan and that the gate path always re-hashes task_plan.md so tampered plans are never trusted. However, check-complete.sh --gate (as well as check-complete.ps1 -Gate and Hermes evaluate_gate) never checks .plan-attestation or .attestation, and hooks/claude-hook.sh does not validate task_plan.md containment on stop. An untrusted repo with .mode set to gate, or an attacker that modifies an attested task_plan.md during a session, can block the agent from stopping for up to 20 turns and inject an unframed, unbounded ### heading line directly into the host's imperative continuation reason.
Fix: Verify task_plan.md containment and SHA-256 attestation inside check-complete.sh --gate, check-complete.ps1 -Gate, and evaluate_gate before blocking a stop, and allow the stop immediately if attestation is missing or invalid.
-
MediumPowerShell ledger and phase helpers allow path traversal via .active_plan
Unlike resolve-plan-dir.ps1, which validates plan IDs against a strict slug pattern, rejects symlinks and junctions, and verifies workspace containment, ledger-append.ps1, phase-status.ps1, and ledger-summary.ps1 implement their own Resolve-PlanDir and Resolve-PlanFile functions that pass .planning/.active_plan content (or $env:PLAN_ID) directly into Join-Path without validation. If an untrusted repository includes a .planning/.active_plan containing ..\..\ traversal segments (or a junction), running ledger-append.ps1 writes ledger JSONL files into arbitrary existing directories outside the repository, and phase-status.ps1 can modify external task_plan.md files.
Fix: Replace the inline Resolve-PlanDir and Resolve-PlanFile functions in ledger-append.ps1, phase-status.ps1, and ledger-summary.ps1 with calls to resolve-plan-dir.ps1 and reject symlinks on target files.
-
MediumStop completion gate skips SHA-256 plan attestation and injects unframed phase headings
.dsh/packages/dsh-planning-with-files/src/core.ts:558
SKILL.md states that v3 modes require SHA-256 attestation and that the gated Stop path always re-hashes task_plan.md so tampered plans cannot drive continuation. In practice, evaluateGate() in both the DeepSeek Harness and OpenCode plugins, as well as skill-hook.sh (which calls inject-plan with --context=validate, a mode that exits before checking attestation) and check-complete.sh / check-complete.ps1, never verify .attestation or .plan-attestation. Even when UserPromptSubmit blocks a modified task_plan.md as '[PLAN TAMPERED]', the Stop gate still reads the tampered file at the end of the turn, extracts the full '### ' heading line of no bounded length without DATA ONLY delimiter framing, and sends it to the agent as an imperative continuation prompt.
Fix: Verify plan SHA-256 attestation before evaluating the Stop gate (calling verifyPlan() in core.ts and enforcing attestation in check-complete.sh / check-complete.ps1), allow the stop immediately on mismatch, and cap and sanitize the phase heading length.
-
MediumOpenCode and DeepSeek Harness plugins inject unattested progress.md text in v3 autonomous and gated modes
.opencode/packages/opencode-planning-with-files/src/core.ts:470
According to SKILL.md and README.md, v3 autonomous and gated modes stop injecting the raw tail of progress.md because progress.md is not covered by SHA-256 attestation and untrusted tool output or web summaries logged there during unattended runs would otherwise be re-injected on every turn. However, buildContext() in both opencode-planning-with-files and dsh-planning-with-files ignores verified.mode and unconditionally injects the last 20 lines (up to 16 KiB) of raw progress.md into model context on every turn.
Fix: Check verified.mode in buildContext() and replace raw progress.md tail injection with a synthesized, free-text-free ledger summary when the plan is in autonomous or gated mode.
-
MediumOpenCode 2.x adapter appends workspace plan and progress files directly into the system prompt
.opencode/packages/opencode-planning-with-files/src/v2.ts:49
In the OpenCode 2.x adapter, the session 'context' hook pushes the output of buildContext()—which contains project task_plan.md and progress.md file contents—directly into event.system (the LLM system prompt) on every turn. Whereas OpenCode 1.x and DeepSeek Harness attach plan state as user-role messages, placing untrusted workspace or research file text inside event.system elevates any embedded prompt injection to system-prompt authority.
Fix: Deliver plan and progress context as a user-role or tool-context message rather than appending workspace file contents to event.system.
-
MediumPlan initialization follows symlinks to create or overwrite files outside the project directory
.opencode/packages/opencode-planning-with-files/src/core.ts:777
In initPlan() (exposed to the model as the pwf_init tool and to users as /pwf in OpenCode and DeepSeek Harness), fs.mkdirSync(planDir, { recursive: true }) is called without checking whether planDir is a symlink to an external directory, and copyTemplates() and applyV3Mode() write task_plan.md, findings.md, progress.md, .stop_blocks, .nonce, and .mode using fs.existsSync, fs.copyFileSync, and fs.writeFileSync—all of which follow symlinks. In OpenCode, pwf_init also runs without invoking toolContext.ask(), allowing a prompt-injected agent in a repository with pre-planted symlinks to write files outside the workspace without triggering external-directory permission prompts. The shell initializer init-session.sh has the same gap in legacy root mode.
Fix: Check lstat before creating or writing any plan directory, template file, or mode sidecar, reject symlinks and paths resolving outside the canonical project root, and write exclusively with O_CREAT | O_EXCL (wx).
-
MediumGlobal Codex and Mastra hook configs execute untrusted workspace scripts before $HOME fallbacks
Each hook in .codex/hooks.json (and the Stop hook in .mastracode/hooks.json) tries to execute a relative path inside the current working directory (.codex/hooks/*.py or .mastracode/skills/...) before falling back to the user's home directory ($HOME/.codex/hooks/...). When a user installs these hooks globally in ~/.codex/hooks.json or ~/.mastracode/hooks.json, the agent trusts the global configuration everywhere, so opening a session in an untrusted cloned repository that contains .codex/hooks/run_sh.py (or .mastracode/.../check-complete.sh) executes the stranger's code automatically on SessionStart or Stop.
Fix: Separate workspace and global hook configurations, or reference only the trusted global path ($HOME/.codex/hooks/...) in personal installs, and pass -I to python3.
-
LowHermes and shell plan initializers follow symlinks to write files outside the workspace
.hermes/plugins/planning-with-files/planning_files.py:187
In the Hermes plugin's init_plan function, creating a named plan (/pwf <name> or planning_with_files_init) does not check whether project_dir/.planning is a symlink pointing outside project_dir; _active_plan_pointer_error only checks containment relative to planning_root.resolve(), so a symlinked .planning directory redirects directory and file creation into any external folder. Additionally, apply_v3_mode in planning_files.py and init-session.sh write .stop_blocks, .nonce, .mode, and dangling-symlink template targets without no-follow checks, allowing symlinks in an untrusted repo to overwrite or create files outside the project during initialization.
Fix: Verify that .planning is a real directory contained within project_dir before creating plan subdirectories, and refuse symlinks or reparse points on all template and mode sidecar files before writing.
-
LowCodex and Hermes hooks bypass root .mode attestation policy and inject unattested progress logs
.codex/hooks/user-prompt-submit.sh:70
The documentation states that a committed root .mode file acts as a project-wide floor that named plans under .planning/<slug>/ cannot lower, and that autonomous and gated modes replace raw progress.md tail injection with a synthesized ledger summary so unattested text written to progress.md cannot inject instructions every turn. However, .codex/hooks/user-prompt-submit.sh, .codex/hooks/pre-tool-use.sh, and Hermes hooks.py ignore the root .mode file whenever a named slug plan is active, allowing a newly created slug plan to drop mandatory attestation, and both adapters unconditionally inject the raw 20-line tail of progress.md even in autonomous and gated modes.
Fix: Enforce the root .mode floor when resolving slug plans in Codex hooks and Hermes pre_llm_call (using mode_tokens in Hermes), and emit the structured ledger summary instead of raw progress.md lines in autonomous and gated modes.
-
LowUnix attestation helper follows symlinks to read arbitrary files on --show and truncate files via .attestation.lock
.continue/skills/planning-with-files/scripts/attest-plan.sh:207
Unlike attest-plan.ps1 on Windows—which uses FILE_FLAG_OPEN_REPARSE_POINT, directory containment checks, and a 4 KiB cap—attest-plan.sh (and its copies across IDE and i18n skill folders) performs no symlink or containment checks on .plan-attestation, .attestation, .nonce, or .attestation.lock. Running attest-plan.sh --show in a repository where .plan-attestation or .nonce is a symlink prints the target file (such as SSH keys or .env secrets) into stdout and agent context, while running attest-plan.sh (including automatically via init-session.sh --autonomous or --gated) opens '9>${lock_dir}/.attestation.lock' under flock, truncating any symlink target to zero bytes.
Fix: Verify that task_plan.md, the attestation file, .nonce, and .attestation.lock are regular files contained within the project root (not symlinks or hardlinks), cap --show reads to 128 bytes, and create temporary and lock files safely.
-
LowClaude fast-path PostToolUse marker falls back to /tmp/pwf-turn without private permissions or O_NOFOLLOW
.cursor/skills/planning-with-files/scripts/inject-plan.py:1666
While pretool_cache() and skill-hook.sh enforce 0700 permissions, UID ownership, O_NOFOLLOW, and refuse shared /tmp fallback when HOME and XDG_CACHE_HOME are unset, ClaudeDispatcher.turn_marker_path() and post_tool_nudge() in inject-plan.py (and its IDE mirrors) fall back to /tmp/pwf-turn, create it without 0700 mode or ownership verification, and open the predictable 16-hex marker path with open(marker, 'wb'). In container or multi-user environments where HOME and XDG_CACHE_HOME are unset, another local user could pre-create symlinks in /tmp/pwf-turn to truncate files owned by the hook user.
Fix: Use the same private directory validation and O_CREAT | O_EXCL | O_NOFOLLOW atomic creation in ClaudeDispatcher.turn_marker_path() as in pretool_cache(), and skip caching when HOME and XDG_CACHE_HOME are unset.
-
LowPi extension reads symlinked task_plan.md and progress.md files without containment checks
.pi/skills/planning-with-files/extensions/planning-with-files/plan.ts:271
While resolvePlanPaths checks realpath containment on scoped .planning/<slug> directories, neither resolvePlanPaths nor readPlanStatus checks whether task_plan.md or progress.md itself is a symlink pointing outside the repository (in either root mode or scoped mode). If a user approves a clean-looking task_plan.md with /plan-execute in a repository where progress.md is a symlink to an external file, readFileSync follows the symlink and injects its contents into model context on every turn; the Pi extension also ignores PLANNING_DISABLED=1.
Fix: Verify with lstatSync and realpathSync that both task_plan.md and progress.md are regular files resolving inside the project anchor before reading them, and honor PLANNING_DISABLED=1.
-
LowPowerShell ledger and phase-status helpers allow path traversal via .planning/.active_plan
skills/i18n/planning-with-files-ar/scripts/ledger-append.ps1:72
Unlike resolve-plan-dir.ps1, the inline Resolve-PlanDir and Resolve-PlanFile functions in ledger-append.ps1, phase-status.ps1, and ledger-summary.ps1 (across all five skills/i18n/planning-with-files-* copies) read .planning/.active_plan and pass it directly to Join-Path without slug validation, symlink/junction checks, or root containment checks. If an untrusted repository contains a relative traversal path such as ../../other-dir in .planning/.active_plan (or a directory junction), running these helpers writes ledger files or modifies task_plan.md outside the project directory.
Fix: Delegate plan directory resolution in ledger-append.ps1, phase-status.ps1, and ledger-summary.ps1 to resolve-plan-dir.ps1 so slug, link, and containment checks are enforced.
-
LowShell attestation and ledger locks follow symlinks and can truncate arbitrary user files
skills/i18n/planning-with-files-de/scripts/attest-plan.sh:284
Whereas attest-plan.ps1 uses no-follow file handles on Windows, attest-plan.sh (across all localized skill copies) opens ${lock_dir}/.attestation.lock using standard shell redirection (9>...) without O_NOFOLLOW, and ledger-append.sh does the same with .ledger_lock and ledger-*.jsonl. If an untrusted repository contains a symlink at .attestation.lock or .ledger_lock pointing to a user file outside the repository, running /plan-attest or ledger-append.sh truncates the target file before unlinking the symlink.
Fix: Reject symlinked lock and output files before opening them or use an exclusive directory/owner-file lock like phase-status.sh instead of shell truncation redirects.
-
LowLoop tick prompts instruct the agent to run a relative workspace script path
Unlike the other plugin commands and templates/loop.md—which invoke ${CLAUDE_PLUGIN_ROOT}/scripts/check-complete.sh—the default tick prompt in commands/plan-loop.md (as well as DEFAULT_LOOP_PROMPT in the Pi extension's constants.ts and the manual fallback in SKILL.md) instructs the agent to run the relative path scripts/check-complete.sh. If a user starts /plan-loop in a repository where an untrusted branch or contributor placed a malicious scripts/check-complete.sh, the prompt directs the agent to execute that workspace script.
Fix: Qualify check-complete.sh with ${CLAUDE_PLUGIN_ROOT}/scripts/check-complete.sh (or the installed skill directory path) in commands/plan-loop.md, SKILL.md, and Pi's DEFAULT_LOOP_PROMPT.
-
LowCursor Windows hooks and Continue prompt use PowerShell -ExecutionPolicy Bypass
All four hooks in .cursor/hooks.windows.json (and the Windows setup step in .continue/prompts/planning-with-files.prompt) invoke PowerShell with -ExecutionPolicy Bypass, disabling Windows script signing and execution policy protections despite the project migrating other hooks to RemoteSigned.
Fix: Replace -ExecutionPolicy Bypass with -ExecutionPolicy RemoteSigned in .cursor/hooks.windows.json and .continue/prompts/planning-with-files.prompt.
-
LowKiro steering template auto-includes plan and progress files without data-only framing
.kiro/skills/planning-with-files/assets/templates/planning-context.md:13
When bootstrapped in Kiro, planning-context.md is copied to .kiro/steering/ with inclusion: auto and embeds the full contents of .kiro/plan/task_plan.md and .kiro/plan/progress.md via live file references. Unlike the hook-based integrations for other hosts—which wrap excerpts in nonce-tagged BEGIN/END data delimiters, cap their size, and omit raw progress.md in autonomous modes—this steering template injects the entire files into Kiro's steering context with no warning to treat their contents as untrusted data. If the agent logs untrusted error messages or tool outputs into progress.md as instructed by the workflow, embedded prompt-injection text is re-injected as steering context on later turns.
Fix: Add explicit instructions in planning-context.md around the #[[file:...]] directives telling the model to treat the included task_plan.md and progress.md contents strictly as untrusted structured data rather than instructions.
