diff --git a/graphify/skill-agents.md b/graphify/skill-agents.md index ac1ea3189..3f7fade81 100644 --- a/graphify/skill-agents.md +++ b/graphify/skill-agents.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/graphify/skill-aider.md b/graphify/skill-aider.md index f156f1298..6e459945a 100644 --- a/graphify/skill-aider.md +++ b/graphify/skill-aider.md @@ -91,8 +91,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/graphify/skill-amp.md b/graphify/skill-amp.md index ac1ea3189..3f7fade81 100644 --- a/graphify/skill-amp.md +++ b/graphify/skill-amp.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/graphify/skill-claw.md b/graphify/skill-claw.md index e872ce905..2eca2a295 100644 --- a/graphify/skill-claw.md +++ b/graphify/skill-claw.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/graphify/skill-codex.md b/graphify/skill-codex.md index cce6551b2..a126527fd 100644 --- a/graphify/skill-codex.md +++ b/graphify/skill-codex.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/graphify/skill-copilot.md b/graphify/skill-copilot.md index e872ce905..2eca2a295 100644 --- a/graphify/skill-copilot.md +++ b/graphify/skill-copilot.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/graphify/skill-devin.md b/graphify/skill-devin.md index 0f256842e..9bd1f0dc7 100644 --- a/graphify/skill-devin.md +++ b/graphify/skill-devin.md @@ -104,8 +104,8 @@ mkdir -p graphify-out # Force UTF-8 I/O on Windows (prevents garbled CJK/non-ASCII output) export PYTHONUTF8=1 # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/graphify/skill-droid.md b/graphify/skill-droid.md index c60ec15a5..b1eeb4925 100644 --- a/graphify/skill-droid.md +++ b/graphify/skill-droid.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/graphify/skill-kilo.md b/graphify/skill-kilo.md index 39c2cbdcd..387563de4 100644 --- a/graphify/skill-kilo.md +++ b/graphify/skill-kilo.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/graphify/skill-kiro.md b/graphify/skill-kiro.md index e872ce905..2eca2a295 100644 --- a/graphify/skill-kiro.md +++ b/graphify/skill-kiro.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/graphify/skill-opencode.md b/graphify/skill-opencode.md index c5dd37d91..144378e65 100644 --- a/graphify/skill-opencode.md +++ b/graphify/skill-opencode.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/graphify/skill-pi.md b/graphify/skill-pi.md index e872ce905..2eca2a295 100644 --- a/graphify/skill-pi.md +++ b/graphify/skill-pi.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/graphify/skill-trae.md b/graphify/skill-trae.md index fc533f1c1..36706e3d7 100644 --- a/graphify/skill-trae.md +++ b/graphify/skill-trae.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/graphify/skill-vscode.md b/graphify/skill-vscode.md index 31d1e983b..6191a4ca6 100644 --- a/graphify/skill-vscode.md +++ b/graphify/skill-vscode.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/graphify/skill.md b/graphify/skill.md index e872ce905..2eca2a295 100644 --- a/graphify/skill.md +++ b/graphify/skill.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/tests/test_skillgen_input_path_injection.py b/tests/test_skillgen_input_path_injection.py index 35933763c..752b5d3bf 100644 --- a/tests/test_skillgen_input_path_injection.py +++ b/tests/test_skillgen_input_path_injection.py @@ -56,11 +56,16 @@ def step1_script() -> str: def _run_step1(script: str, input_path_value: str, cwd: Path) -> subprocess.CompletedProcess: - if sys.platform == "win32" and len(input_path_value) > 2 and input_path_value[1] == ":": - # Convert Windows absolute path (C:\...) to WSL mount path (/mnt/c/...) - drive = input_path_value[0].lower() - rest = input_path_value[2:].replace("\\", "/") - input_path_value = f"/mnt/{drive}{rest}" + if sys.platform == "win32": + if len(input_path_value) > 2 and input_path_value[1] == ":": + drive = input_path_value[0].lower() + rest = input_path_value[2:].replace("\\", "/") + input_path_value = f"/mnt/{drive}{rest}" + else: + def _conv(m: re.Match) -> str: + clean_path = m.group(2).replace("\\", "/") + return f"/mnt/{m.group(1).lower()}/{clean_path}" + input_path_value = re.sub(r"([A-Za-z]):[\\/]([^\s\"'`;#|)\n]+)", _conv, input_path_value) substituted = script.replace("INPUT_PATH", input_path_value).replace("\r\n", "\n") if sys.platform == "win32": # On Windows, writing to a temp script file avoids CreateProcess quote-escaping @@ -187,11 +192,14 @@ def test_step1_still_resolves_a_legitimate_path(tmp_path: Path, skill_file: str) f"stdout={result.stdout!r} stderr={result.stderr!r}" ) marker_content = marker.read_text(encoding="utf-8").strip() - drive_letter = project.drive[0].lower() - if sys.platform == "win32" and marker_content.startswith(f"/mnt/{drive_letter}/"): - resolved_marker = Path(f"{drive_letter.upper()}:{marker_content[6:]}").resolve() - elif sys.platform == "win32" and marker_content.startswith(f"/{drive_letter}/"): - resolved_marker = Path(f"{drive_letter.upper()}:{marker_content[2:]}").resolve() + if sys.platform == "win32" and project.drive: + drive_letter = project.drive[0].lower() + if marker_content.startswith(f"/mnt/{drive_letter}/"): + resolved_marker = Path(f"{drive_letter.upper()}:{marker_content[6:]}").resolve() + elif marker_content.startswith(f"/{drive_letter}/"): + resolved_marker = Path(f"{drive_letter.upper()}:{marker_content[2:]}").resolve() + else: + resolved_marker = Path(marker_content).resolve() else: resolved_marker = Path(marker_content).resolve() assert resolved_marker == project.resolve() diff --git a/tools/skillgen/expected/graphify__skill-agents.md b/tools/skillgen/expected/graphify__skill-agents.md index ac1ea3189..3f7fade81 100644 --- a/tools/skillgen/expected/graphify__skill-agents.md +++ b/tools/skillgen/expected/graphify__skill-agents.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/tools/skillgen/expected/graphify__skill-aider.md b/tools/skillgen/expected/graphify__skill-aider.md index f156f1298..6e459945a 100644 --- a/tools/skillgen/expected/graphify__skill-aider.md +++ b/tools/skillgen/expected/graphify__skill-aider.md @@ -91,8 +91,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/tools/skillgen/expected/graphify__skill-amp.md b/tools/skillgen/expected/graphify__skill-amp.md index ac1ea3189..3f7fade81 100644 --- a/tools/skillgen/expected/graphify__skill-amp.md +++ b/tools/skillgen/expected/graphify__skill-amp.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/tools/skillgen/expected/graphify__skill-claw.md b/tools/skillgen/expected/graphify__skill-claw.md index e872ce905..2eca2a295 100644 --- a/tools/skillgen/expected/graphify__skill-claw.md +++ b/tools/skillgen/expected/graphify__skill-claw.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/tools/skillgen/expected/graphify__skill-codex.md b/tools/skillgen/expected/graphify__skill-codex.md index cce6551b2..a126527fd 100644 --- a/tools/skillgen/expected/graphify__skill-codex.md +++ b/tools/skillgen/expected/graphify__skill-codex.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/tools/skillgen/expected/graphify__skill-copilot.md b/tools/skillgen/expected/graphify__skill-copilot.md index e872ce905..2eca2a295 100644 --- a/tools/skillgen/expected/graphify__skill-copilot.md +++ b/tools/skillgen/expected/graphify__skill-copilot.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/tools/skillgen/expected/graphify__skill-devin.md b/tools/skillgen/expected/graphify__skill-devin.md index 0f256842e..9bd1f0dc7 100644 --- a/tools/skillgen/expected/graphify__skill-devin.md +++ b/tools/skillgen/expected/graphify__skill-devin.md @@ -104,8 +104,8 @@ mkdir -p graphify-out # Force UTF-8 I/O on Windows (prevents garbled CJK/non-ASCII output) export PYTHONUTF8=1 # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/tools/skillgen/expected/graphify__skill-droid.md b/tools/skillgen/expected/graphify__skill-droid.md index c60ec15a5..b1eeb4925 100644 --- a/tools/skillgen/expected/graphify__skill-droid.md +++ b/tools/skillgen/expected/graphify__skill-droid.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/tools/skillgen/expected/graphify__skill-kilo.md b/tools/skillgen/expected/graphify__skill-kilo.md index 39c2cbdcd..387563de4 100644 --- a/tools/skillgen/expected/graphify__skill-kilo.md +++ b/tools/skillgen/expected/graphify__skill-kilo.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/tools/skillgen/expected/graphify__skill-kiro.md b/tools/skillgen/expected/graphify__skill-kiro.md index e872ce905..2eca2a295 100644 --- a/tools/skillgen/expected/graphify__skill-kiro.md +++ b/tools/skillgen/expected/graphify__skill-kiro.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/tools/skillgen/expected/graphify__skill-opencode.md b/tools/skillgen/expected/graphify__skill-opencode.md index c5dd37d91..144378e65 100644 --- a/tools/skillgen/expected/graphify__skill-opencode.md +++ b/tools/skillgen/expected/graphify__skill-opencode.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/tools/skillgen/expected/graphify__skill-pi.md b/tools/skillgen/expected/graphify__skill-pi.md index e872ce905..2eca2a295 100644 --- a/tools/skillgen/expected/graphify__skill-pi.md +++ b/tools/skillgen/expected/graphify__skill-pi.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/tools/skillgen/expected/graphify__skill-trae.md b/tools/skillgen/expected/graphify__skill-trae.md index fc533f1c1..36706e3d7 100644 --- a/tools/skillgen/expected/graphify__skill-trae.md +++ b/tools/skillgen/expected/graphify__skill-trae.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/tools/skillgen/expected/graphify__skill-vscode.md b/tools/skillgen/expected/graphify__skill-vscode.md index 31d1e983b..6191a4ca6 100644 --- a/tools/skillgen/expected/graphify__skill-vscode.md +++ b/tools/skillgen/expected/graphify__skill-vscode.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/tools/skillgen/expected/graphify__skill.md b/tools/skillgen/expected/graphify__skill.md index e872ce905..2eca2a295 100644 --- a/tools/skillgen/expected/graphify__skill.md +++ b/tools/skillgen/expected/graphify__skill.md @@ -97,8 +97,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/tools/skillgen/fragments/core/aider.md b/tools/skillgen/fragments/core/aider.md index f156f1298..6e459945a 100644 --- a/tools/skillgen/fragments/core/aider.md +++ b/tools/skillgen/fragments/core/aider.md @@ -91,8 +91,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/tools/skillgen/fragments/core/devin.md b/tools/skillgen/fragments/core/devin.md index 0f256842e..9bd1f0dc7 100644 --- a/tools/skillgen/fragments/core/devin.md +++ b/tools/skillgen/fragments/core/devin.md @@ -104,8 +104,8 @@ mkdir -p graphify-out # Force UTF-8 I/O on Windows (prevents garbled CJK/non-ASCII output) export PYTHONUTF8=1 # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/tools/skillgen/fragments/shell/posix.md b/tools/skillgen/fragments/shell/posix.md index ed0c555aa..b9cdfe5f0 100644 --- a/tools/skillgen/fragments/shell/posix.md +++ b/tools/skillgen/fragments/shell/posix.md @@ -31,8 +31,8 @@ fi mkdir -p graphify-out "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" # Save scan root so `graphify update` (no args) knows where to look next time. -# INPUT_PATH is passed through a quoted heredoc, never substituted into the -# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which +# The scan path is passed through a quoted heredoc, never substituted into the +# command line itself: a bare `cd ` (or an unquoted heredoc, which # still expands $()/backticks in its body) would let a malicious path execute # as shell code the moment this line runs. "$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF' diff --git a/tools/skillgen/gen.py b/tools/skillgen/gen.py index a44fa3dd4..6c30a0847 100644 --- a/tools/skillgen/gen.py +++ b/tools/skillgen/gen.py @@ -1155,8 +1155,8 @@ def _is_step1_root_marker_fix_line(line: str) -> bool: stripped.startswith('"$PYTHON" -c "import os, sys; out_path = os.path.abspath(\'graphify-out/.graphify_root\')') or stripped in ("INPUT_PATH", "GRAPHIFY_ROOT_EOF") or stripped == "# Save scan root so `graphify update` (no args) knows where to look next time." - or stripped == "# INPUT_PATH is passed through a quoted heredoc, never substituted into the" - or stripped == "# command line itself: a bare `cd INPUT_PATH` (or an unquoted heredoc, which" + or stripped == "# The scan path is passed through a quoted heredoc, never substituted into the" + or stripped == "# command line itself: a bare `cd ` (or an unquoted heredoc, which" or stripped == "# still expands $()/backticks in its body) would let a malicious path execute" or stripped == "# as shell code the moment this line runs." )