fix: classify js module and php suffixes as executable content - #480
fix: classify js module and php suffixes as executable content#480MohammedAlkindi wants to merge 1 commit into
Conversation
|
LGTM, waiting on rebase to pass |
|
Powered by Codex: I checked the suffix-only additions against both SkillSpector's existing analyzer routing and the actual runtime semantics. Short answer: these are all script-bearing / executable-capable suffixes, but they are not all unconditionally or directly executable merely because of the suffix.
That means the PR reasonably closes an internal policy mismatch: these suffixes were already routed through SkillSpector's script analyzers, while One concrete false-positive edge remains: |
Signed-off-by: Mohammed Alkindi <alkndymhmd692@gmail.com>
95fe426 to
a4bb9fc
Compare
| @pytest.mark.parametrize( | ||
| "suffix", | ||
| [".cjs", ".cts", ".jsx", ".mjs", ".mts", ".tsx", ".php", ".phtml", ".rake"], | ||
| ) |
There was a problem hiding this comment.
One concrete false-positive edge remains: Path(path).suffix classifies types.d.cts and types.d.mts as executable even though those are TypeScript declaration files, not runtime implementations. I recommend explicitly excluding .d.cts and .d.mts and adding regression tests. Apart from that declaration-file case, I did not find an added suffix that is wholly unrelated to executable code.
Please handle this @MohammedAlkindi
_EXECUTABLE_SUFFIXES(nested_artifacts.py:51) lists.jsand.rbbut not.mjs,.cjs,.jsx,.tsx,.mts,.cts,.php*or.rake, sois_executable_contentreturns False for files the scanner's own language maps already treat as script source:_JAVASCRIPT_EXTENSIONS(static_patterns_output_handling.py:76) lists all eight JS/TS forms, and_LANG_BY_EXT(static_patterns_deserialization.py:47) maps.php*and.rake.That flag gates more than a label.
mcp_least_privilege.py:481returns early as a docs-only skill when nothing is executable, andnested_artifacts.py:984setsconcealed_executableonly when it is true.Three skills with byte-identical script bodies, differing only in extension, scanned with
--no-llm. Before:After, all three are executable at score 19.
Those bodies deliberately carry no shebang. The magic-byte fallback already rescues shebang'd files, and the
0o111fallback rescues anything carrying the exec bit, so what this changes is suffix-only scripts.Unit suite 3943 to 3953 passed, the extra ten being the new tests, with an identical 23-failure set either side (pre-existing here: Windows symlink and release-tooling).
ruff checkandruff format --checkclean.Added only suffixes an existing analyzer already recognises.
.psm1,.pm,.vbsand.wsfare deliberately left out. Found by inspection, not a user report.