Skip to content

fix(analyzers): keep SC3 and P2 coverage for PowerShell scripts - #874

Merged
rng1995 merged 2 commits into
NVIDIA:mainfrom
udsy19:fix/powershell-sc3-p2-gates
Oct 28, 2026
Merged

rng1995 merged 2 commits into
NVIDIA:mainfrom
udsy19:fix/powershell-sc3-p2-gates

Conversation

@udsy19

@udsy19 udsy19 commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Fixes #873.

Impact: silent-wrong-result

Who reaches this: any skillspector scan (CLI or MCP) of a skill that bundles a .ps1 script, including the --fail-on-findings CI 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, .ps1 is 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:

setup.ps1   issues: []              max_issue_severity: NONE  --fail-on-findings exit 0
setup.psm1  issues: [SC3 HIGH 0.5]  max_issue_severity: HIGH  --fail-on-findings exit 1

With the fix, .ps1 gets 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.py mirrors test_perl_classification_preserves_generic_analyzer_coverage. It scans each case as setup.generic and as setup.ps1, and requires the same HIGH finding for both. The cases are an HTML-comment P2, the SC3 decode prose, a base64 IEX stage, and a hex literal.

Negative control (both analyzer files reverted to main):

FFFF
4 failed

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]

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]>

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

@rng1995
rng1995 merged commit d56c2f1 into NVIDIA:main Oct 28, 2026
6 checks passed
rng1995 pushed a commit that referenced this pull request Oct 30, 2026
#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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.ps1 scripts skip SC3 and P2 checks that untyped files get

2 participants