fix(skillgen): prevent INPUT_PATH shell injection

This commit is contained in:
himanshupatro-334 committed 2026-09-26 22:55:58 +05:30
1 parent a898e6890c
commit a9551306af
35 files changed
+86 -78

No files matched your search

+2 -2
View File
@@ -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 <path>` (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'
+2 -2
View File
@@ -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 <path>` (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'
+2 -2
View File
@@ -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 <path>` (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'
+2 -2
View File
@@ -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 <path>` (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'
+2 -2
View File
@@ -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 <path>` (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'
+2 -2
View File
@@ -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 <path>` (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'
+2 -2
View File
@@ -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 <path>` (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'
+2 -2
View File
@@ -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 <path>` (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'
+2 -2
View File
@@ -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 <path>` (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'
+2 -2
View File
@@ -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 <path>` (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'
+2 -2
View File
@@ -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 <path>` (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'
+2 -2
View File
@@ -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 <path>` (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'
+2 -2
View File
@@ -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 <path>` (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'
+2 -2
View File
@@ -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 <path>` (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'
+2 -2
View File
@@ -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 <path>` (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'
+18 -10
View File
@@ -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()
@@ -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 <path>` (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'
@@ -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 <path>` (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'
@@ -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 <path>` (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'
@@ -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 <path>` (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'
@@ -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 <path>` (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'
@@ -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 <path>` (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'
@@ -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 <path>` (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'
@@ -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 <path>` (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'
@@ -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 <path>` (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'
@@ -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 <path>` (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'
@@ -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 <path>` (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'
@@ -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 <path>` (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'
@@ -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 <path>` (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'
@@ -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 <path>` (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'
+2 -2
View File
@@ -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 <path>` (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'
+2 -2
View File
@@ -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 <path>` (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'
+2 -2
View File
@@ -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 <path>` (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'
+2 -2
View File
@@ -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 <path>` (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'
+2 -2
View File
@@ -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 <path>` (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."
)