Skip to content

fix: preserve Perl print literal boundaries in static analysis - #615

Merged
rng1995 merged 3 commits into
mainfrom
naren/fix-ae1-perl-help-text
Sep 23, 2026
Merged

rng1995 merged 3 commits into
mainfrom
naren/fix-ae1-perl-help-text

Conversation

@rng1995

@rng1995 rng1995 commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Referencing a Perl helper containing print "Use rm to remove a project\n"; currently produces HIGH AE1 findings even though the helper is readable and prints ordinary help text. The shell parser treats the closing Perl quote as an unmatched shell quote, records static_parse_limit, and propagates the partial result to every reference.

The customer reported this false-positive AE1 failure with SkillEvaluator 1.5.8 in NVCI run kpabani-ban-2026-09-23-001 (CI logs) and asked us to fix it. The report contains two HIGH AE1 findings for scripts/nvip_remove_project_iplite.pl, referenced at SKILL.md:52 and SKILL.md:351. A harmless Perl helper reproduces the reported failure signature; replay of the original customer helper is still needed to confirm its exact trigger.

Recognize a bounded form of standalone Perl literal print with LF or CRLF endings and preserve the ownership of its outer quotes. The entire payload remains subject to command scanning. Executable quote contexts, ambiguous package separators and sigil forms, interpolation, fragments, and genuine parser limits keep conservative coverage. Perl classification retains the existing hidden-instruction P2 and encoded-execution SC3 checks.

AE1 now carries a descriptive pattern, bounded target/analyzer/reason evidence, applicable limits, and targeted remediation. Individual references and incomplete-analysis gates remain intact. README and resource-bound documentation explain the diagnostics, supported Perl subset, and troubleshooting steps.

Validation:

  • 162 Perl regressions and 516 broader static-pattern, runner, supply-chain, and finalizer checks passed.
  • Independent review compared 330 TM1 combinations and 15 analyzers across 10 fixtures: no previously detected findings were lost after the applicability corrections.
  • 19 native scanner-to-evaluator cases passed, covering harmless LF/CRLF help, executable removal, hidden instructions, encoded execution, ambiguous source, and real parser limits.
  • Ruff lint/format and diff checks passed.

This is a bounded recognizer, not general Perl parsing support. The reproductions are synthetic and never execute their payloads. Downstream adoption requires a published release wheel containing the correction.

@rng1995
rng1995 marked this pull request as ready for review September 23, 2026 07:39

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewed the parser ownership boundaries, AE1 ledger evidence, and regression coverage. The existing CI is green. One confirmed context-ownership issue should be fixed before merging; details and a safe reproducer are inline. This is a comment-only review, not approval.

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The deeper cumulative review found an additional security regression in cross-analyzer file-type dispatch. This needs correction before merge; the existing parser-specific tests do not cover it.

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

One additional compatibility gap from the full review: the supported harmless-print case should behave consistently on LF and CRLF source.

@rng1995
rng1995 merged commit fe59e0f into main Sep 23, 2026
5 checks passed
@rng1995
rng1995 deleted the naren/fix-ae1-perl-help-text branch September 23, 2026 11:57
rng1995 pushed a commit that referenced this pull request Oct 28, 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]>
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.

1 participant