[BUG] security-guidance drops source files with Git-quoted diff paths
Summary
security-guidance silently excludes source files whose Git diff headers use quoted paths. With default core.quotePath=true, a filename such as café.py produces a quoted header that the parser does not recognize.
Source audit and local reproduction at commit 3deb873687379f0c199a69fdaccc65f0865f7a29, Windows / Python 3.13. This is a Python helper reproduction; no Claude CLI/model version was exercised.
Reproduce
From the repository root, run this with Python (it creates an isolated temporary Git repository and does not execute the generated source files):
import subprocess, sys, tempfile
from pathlib import Path
sys.dont_write_bytecode = True
sys.path.insert(0, str(Path.cwd() / "plugins/security-guidance/hooks"))
from gitutil import parse_diff_into_files, extract_file_paths_from_diff, get_git_diff
with tempfile.TemporaryDirectory() as tmp:
repo = Path(tmp)
def git(*args):
return subprocess.check_output(
["git", "-c", "core.hooksPath=/dev/null", "-c", "core.quotePath=true", *args],
cwd=repo).decode("utf-8")
git("init", "-q")
git("-c", "user.name=Audit", "-c", "user.email=audit@example.invalid",
"commit", "--allow-empty", "-qm", "baseline")
(repo / "caf\u00e9.py").write_text(
'print("UNICODE_MARKER")\n', encoding="utf-8")
(repo / "normal.py").write_text(
'print("CONTROL_MARKER")\n', encoding="utf-8")
git("add", ".")
diff = git("diff", "--cached", "--no-color", "--no-ext-diff", "HEAD")
print(diff)
print(extract_file_paths_from_diff(diff))
parsed = dict(parse_diff_into_files(diff))
assert "normal.py" in parsed
assert "caf\u00e9.py" not in parsed # reproduces the defect
actual = get_git_diff(str(repo), "HEAD", paths=[str(repo / "caf\u00e9.py")])
assert "UNICODE_MARKER" in actual
assert parse_diff_into_files(actual) == []
Also reproduced on committed output from git show -p --no-color --no-ext-diff HEAD --.
Actual versus expected
Actual: the Unicode file is absent from both extracted paths and parsed file diffs; an ASCII control file is retained. When only the Unicode file changes, a nonempty get_git_diff result parses to []. Expected: the quoted path is decoded and its complete diff retained.
Cause and review impact
Both helpers assume an unquoted a/... b/... header: gitutil.py. The Stop review can take its no-source-files skip path when parsing yields an empty list, and commit review likewise consumes these parsed diffs. In a mixed change, the omitted file also does not enter the changed-path list derived from parsing.
This demonstrates missing security-review input, not an end-to-end model false negative or a universal bypass: independent Edit/Write regex checks may still run. No RCE or sandbox escape is claimed.
Duplicate check
Targeted public issue/PR searches for parse_diff_into_files, quoted filenames, quotePath, and security-guidance diff parsing found no matching report. PR #76274 changes downstream path normalization, not these parser assumptions. This is not a claim about private reports.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗