Repository navigation
fix: classify js module and php suffixes as executable content - #480
MohammedAlkindi wants to merge 2 commits 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
rng1995
left a comment
There was a problem hiding this comment.
[SkillSpector Review]
Changes requested at head a4bb9fc47f1f5069a576b8cb42c3ce53d934a60f.
src/skillspector/nested_artifacts.py:60: classification usesPath.suffix, so adding.ctsand.mtsalso marks TypeScript declaration files such astypes.d.ctsandtypes.d.mtsas executable even though those formats contain declarations and are not runtime implementations. Explicitly exclude the declaration forms before the suffix check and add regression tests for both. This matches the still-unresolved current-head review thread attests/nodes/test_nested_artifacts.py:836.
Required CI is green, but an active Changes Requested review/unresolved thread, this classification issue, and the BEHIND merge state block merge.
Path.suffix sees only the final component, so the .cts and .mts entries also matched TypeScript declaration files such as types.d.cts. Those carry declarations rather than a runtime implementation. Gate the suffix branch on the declaration forms only; magic-byte and mode detection are unchanged, so a declaration file carrying a shebang or the executable bit still classifies as executable. Signed-off-by: Mohammed Alkindi <alkndymhmd692@gmail.com>
|
Done in Regression test is parametrized over both suffixes. Fail-before on the unmodified source: Left |
rng1995
left a comment
There was a problem hiding this comment.
[SkillSpector Review]
Re-reviewed current head 80c271b5105340571550f351c8b433a9390b7c1e. The prior TypeScript declaration-file false positive is resolved: .d.cts and .d.mts are excluded only from suffix-based classification, while shebang and executable-mode detection remain intact, and regressions cover both declarations and the ordinary executable suffixes. I found no remaining required code or test change.
All required checks pass. Do not merge yet: GitHub reports BEHIND, and the addressed declaration-file thread remains unresolved with an active Changes Requested review from mohgupta-ship-it.
|
@MohammedAlkindi - Please address and resolve the review comments. Further resolve merge conflict, so that we can merge the PR. |
|
Withdrawing this, on two measurements. Every suffix here already landed in #548, so the diff against main is empty apart from the exclusion. And the requested Renaming |
_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.