mirror of
https://github.com/safishamsi/graphify.git
synced 2026-10-15 00:19:33 +00:00
The Fortran capital-F cpp step relied on -nostdinc -I /dev/null to block #include-based host-file reads, but cpp always searches the source file's own directory for quoted includes and always honours absolute paths regardless of those flags. A malicious .F/.F90 file with #include "/etc/passwd" or #include "../../../secret" could inline arbitrary host files into graph.json/GRAPH_REPORT.md and the LLM context on the default offline path (CWE-22/73/200, high severity). Strip every #include directive before preprocessing and feed the sanitized source to cpp on stdin, so cpp never opens the file's directory or any absolute/traversing include path. Macro expansion (#define/#ifdef, the actual reason capital-F files need cpp) is preserved; cross-file include fidelity is traded away to close the arbitrary-read vector. Feeding stdin also removes the -I/etc/x.F90 argument-injection edge case. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>