Repository navigation
fix(analyzers): keep SC3 and P2 coverage for PowerShell scripts - #874
Conversation
NVIDIA#514 typed .ps1 files as "powershell" instead of "other", but the SC3 and P2 file-type gates list "other" and not "powershell". A base64 stage passed to IEX in a .ps1 script therefore produced no finding, while the same bytes under an untyped extension produced SC3 HIGH. Add "powershell" to both gates, as NVIDIA#615 did for "perl". Signed-off-by: Udaya Tejas <[email protected]>
…p2-gates Signed-off-by: Udaya Tejas <[email protected]>
rng1995
left a comment
There was a problem hiding this comment.
[SkillSpector Review]
Value and readiness
Ready. Adding powershell to both existing type gates restores the same SC3/P2 coverage those bytes receive as an untyped file.
Material findings
No required changes found.
PIC tradeoffs
This preserves existing generic signals and severity calibration; it does not attempt PowerShell-specific interpretation. The equality assertion across typed/untyped scans is appropriate for this compatibility correction.
Verification and gaps
Reviewed the complete diff, description, linked issue material, all previous reviews/comments/replies and pinned-head surrounding source at c53e9950e7cc87d848af8c28b212638d20e41f16. Read both changed gates in their analyzer context and all four production-runner regressions, including completed inspection-ledger assertions. GitHub reports changes: SUCCESS, lint: SUCCESS, test-unit: SUCCESS, OpenCode TypeScript Tests: SUCCESS, DCO Check: SUCCESS, docker-smoke: SUCCESS. No contributor code, tests, imports, build steps or scanner invocations were executed during this review.
#514 typed .ps1 files as "powershell" instead of "other", but the SC3 and P2 file-type gates list "other" and not "powershell". A base64 stage passed to IEX in a .ps1 script therefore produced no finding, while the same bytes under an untyped extension produced SC3 HIGH. Add "powershell" to both gates, as #615 did for "perl". Signed-off-by: Udaya Tejas <[email protected]> (cherry picked from commit d56c2f1) Signed-off-by: Narendran Raghavan <[email protected]>
Fixes #873.
Impact: silent-wrong-result
Who reaches this: any
skillspector scan(CLI or MCP) of a skill that bundles a.ps1script, including the--fail-on-findingsCI gate.Triggered when: the script has content that SC3 or P2 reports in an untyped file, such as a base64 stage passed to
IEX. Since #514,.ps1is typed"powershell". The SC3 gate (static_patterns_supply_chain.py:2297) and the P2 gate (static_patterns_prompt_injection.py:365) list"other"but not"powershell".What the user observes, for the same bytes under two extensions:
With the fix,
.ps1gets SC3 HIGH and exit 1. The recommendation is SAFE before and after (score 0 → 16), because a lone 0.5-confidence SC3 stays below CAUTION.Fix
Add
"powershell"to both gates, as #615 did for"perl".Tests
tests/nodes/analyzers/test_powershell_generic_coverage.pymirrorstest_perl_classification_preserves_generic_analyzer_coverage. It scans each case assetup.genericand assetup.ps1, and requires the same HIGH finding for both. The cases are an HTML-comment P2, the SC3 decode prose, a base64IEXstage, and a hex literal.Negative control (both analyzer files reverted to
main):With the fix: 4 passed. The 10 existing test files that mention PowerShell or
.ps1, plus the Perl coverage test, all pass (2074 passed). ruff is clean.Signed-off-by: Udaya Tejas [email protected]