Skip to content

fix(scanner): tighten bounded parser ownership - #947

Merged
rng1995 merged 1 commit into
NVIDIA:mainfrom
kshitijrajes:fix/scanner-parser-yara-regressions
Oct 31, 2026
Merged

rng1995 merged 1 commit into
NVIDIA:mainfrom
kshitijrajes:fix/scanner-parser-yara-regressions

Conversation

@kshitijrajes

Copy link
Copy Markdown
Contributor

Issue

Several bounded-parser and YARA edge cases produce false positives or incomplete analysis for otherwise valid technical documentation:

  • embedded identifiers containing nmap match the offensive-tool signature
  • static quoted NAME=value arguments can spill ownership into later lines
  • computed Make values with static path suffixes hit the parser bound
  • invalid rm -force is interpreted as recursive plus force
  • Verilog numeric apostrophes in explicitly typed hardware/Tcl fences are read as shell quotes

Fix

  • require an identifier boundary before the nmap command signature
  • claim only complete static quoted assignment-like words while preserving nested dynamic command visibility
  • recognize non-destructive computed Make assignment values with constrained static path suffixes
  • accept only valid rm short-option clusters
  • mask only Verilog numeric base markers in explicitly typed Tcl/Verilog/SystemVerilog fences
  • add benign and malicious regression cases for every path

The implementation remains fail-closed for destructive operands, dynamic commands, invalid contexts, untyped fences, and shell fences.

Validation

Focused parser/YARA/security checks: 89 passed.

Regression comparison against the same pre-existing suite:

  • Clean main: 548 passed, 170 failed, 5 deselected
  • Fix branch: 548 passed, 170 failed, 5 deselected

The 170 failures are unchanged pre-existing machine-readable CLI output failures; this change adds no failures to that suite. Fork main and upstream main were aligned at b5987a33, and a merge-tree check found no conflicts.

@mohgupta-ship-it mohgupta-ship-it left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Posted by Codex on Mohit's behalf.

Review recommendation: NEEDS_CHANGES. Five inline findings cover four P1 regressions in destructive-command detection or inspection completeness and one P2 YARA source-location regression.

Reviewed head 376454bd81cd3b628a0662bded99e59f0f1401b5 against base b5987a332c9a118ec4714a5c79eb76641b546251; the head was unchanged immediately before posting. All five findings were reproduced against base and head through the affected public analyzer interfaces. Execution checks used harmless argument recorders.

Validation: 942 focused tests passed; changed-file lint/format and git diff --check passed. These passing tests do not cover the reported cases. Full scanner verdicts with every analyzer and the full repository suite were not established.

CI remains action_required with no jobs run in the inspected workflow. The sole commit also lacks the Signed-off-by: trailer required by the configured DCO check.

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

Requesting changes for scanner regressions on head 376454bd81cd3b628a0662bded99e59f0f1401b5 against base b5987a332c9a118ec4714a5c79eb76641b546251.

I independently reproduced all five existing inline findings through the public analyzer interfaces:

One additional P2 finding is posted inline: the nmap boundary also suppresses detection after escaped newlines in executable Python strings. Base reports YR4; this head reports no findings with completed inspection.

Validation: 854 focused tests passed, including all 25 newly added cases; Ruff passed for the changed Python files. The six reported behaviors were compared directly on base and head. The full repository suite and combined scanner verdicts were not evaluated.

@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

The documentation false positives are real, but the new ownership and operand exemptions retain the security regressions already reported by another reviewer. This head is not ready.

Material findings

Existing reviewer actions, still open and confirmed in source:

  1. src/skillspector/nodes/analyzers/static_patterns_tool_misuse.py:2006 and :2256: a static quoted NAME=value argument claims its complete bytes, including executable sh -c/bash -c/eval bodies such as sh -c 'MODE=x; r""m -r -f /'. Preserve independent executable-body candidates before advancing ownership.
  2. :1644: the Make-shaped exemption accepts nested dynamic substitutions after checking only visible destructive operands, so X := $($(pick) $(printf '\055\162\146') /) bypasses the bounded reconstruction obligation. It also applies in shell input. Unproved nested/constructed operands must stay conservative.
  3. :5256: typed-fence numeric masking treats the opening apostrophe of an ordinary shell argument '1' as a hardware marker. Embedded exec sh -c text can consequently lose the quote ownership needed to retain an unresolved $CMD -rf / warning. Do not infer embedded-shell ownership from the fence label.
  4. :3623: the rm short-option allowlist drops valid BSD/macOS x and P clusters, including -rfx and -rfP. Retain valid clusters and uncertainty, with literal/reconstructed/dynamic controls.
  5. src/skillspector/yara_rules/hacktools.yar:17: consuming the left nmap boundary moves line-leading matches to the preceding newline. Use a nonconsuming boundary and assert the reported command line.
    The existing threads already contain focused reproductions; these are not duplicate inline comments.

PIC tradeoffs

The PR combines unrelated lexer, Make, shell-option, hardware and YARA changes. Each exemption needs an independent ownership proof; positive documentation examples do not establish executable safety.

Verification and gaps

Reviewed exact head 376454bd81cd3b628a0662bded99e59f0f1401b5: complete diff, pinned surrounding source, description, tests and available review/comment threads. Read all four files and every existing reviewer thread/reply. Traced the five code paths and read all new controls; tests omit the reported counterexamples. Hosted DCO is failing and test-unit is running; the other four checks succeeded. Contributor-reported runtime reproductions were treated as evidence, not rerun. No contributor code, tests, imports, builds, scanner invocations or supplied snippets were executed.

@kshitijrajes
kshitijrajes force-pushed the fix/scanner-parser-yara-regressions branch from 376454b to f1bb76f Compare October 30, 2026 03:08

@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

The original five findings and the additional escaped-newline example have been addressed. A remaining host-escape boundary case still removes YR4 detection through the public YARA path, so one focused correction is required.

Material findings

Prior findings resolved: plain quoted assignment ownership now requires a static value without shell clause syntax; ANSI-C words do not enter that shortcut; executable wrapper strings receive an independent destructive-body check. The computed-Make exemption has been removed, retaining partial inspection for unresolved substitutions. Hardware markers no longer consume ordinary quoted digits, and mixed literal/shell-apostrophe ownership remains conservative. Valid BSD/macOS x/P/W clusters are retained. The nonconsuming word boundary restores line-leading nmap locations, and explicit escape alternatives recover the prior encoded-newline example.

Remaining required change — src/skillspector/yara_rules/hacktools.yar:17: the encoded-separator branch only accepts newline encodings. For this valid Python source, the shell receives a semicolon followed by a tab and a real nmap invocation:

import os
os.system("echo ready;\tnmap -sV localhost")

The source byte preceding nmap is the literal t from \t, so the word boundary fails; t is also absent from the new n/x0a/u000a/octal-newline alternatives. The previous unbounded nmap signature retained this invocation. static_yara.node passes canonical raw bytes directly to _match_file and rules.match, without decoding Python strings or applying alternate security views, so this public YARA path does not recover the candidate. Preserve encoded shell separators such as tabs as well as newlines, with an encoded-tab positive regression and the existing identifier/double-escaped negative controls. This finding concerns lost YR4 detection; no combined scanner verdict is claimed.

PIC tradeoffs

The parser fixes intentionally keep ambiguous Make and mixed hardware/shell material partial. That conservative cost is reasonable. The nmap signature needs to distinguish identifiers from host-encoded command separators without relying on a newline-only list.

Verification and gaps

Reviewed exact head f1bb76f1f987b04e4e01c28eddb4db276767cd99: full current diff, pinned implementation and tests, description, every previous review and available comment/thread history. Checked every earlier review and all six inline findings against the current source, and read the complete 231-line parser and 66-line YARA tests. Read pinned static_yara, graph, static_runner and artifact security-view paths: the YARA node matches raw cache bytes once per component, and ordinary ASCII source has no transformed security view. Five hosted checks, including DCO, are successful; test-unit was still running in the snapshot. No runtime reproduction was performed. Static source and hosted-CI evidence only: no contributor code, tests, imports, builds, scanner invocations, supplied snippets or regex probes were executed.

@kshitijrajes
kshitijrajes force-pushed the fix/scanner-parser-yara-regressions branch from f1bb76f to 5a5be04 Compare October 30, 2026 16:46

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

Review of head 5a5be04 (static read only; I did not run the tests). The earlier P1s look addressed. Two inline items remain, plus a scoping suggestion: this bundles five independent fixes (YARA, quoted assignments, Make, rm options, Verilog fences) in ~600 lines, so splitting it would make each easier to audit. Not approving yet.

Prevent documentation false positives without granting unsafe ownership to executable shell content.

Keep quoted assignment arguments conservative when they contain shell clauses, decode and inspect destructive executable command strings, and recognize valid GNU/BSD/macOS rm option clusters without treating invalid one-dash words as options.

Require whole-fence ownership consistency before masking hardware apostrophes. Mixed HDL literals and shell quotes now fail closed, while proven hardware-only fences remain complete.

Remove the computed Make exemption because unresolved selectors and operands can execute recursively expanded functions and cannot be proven safe locally.

Use separate non-consuming command-token and encoded-separator nmap signatures. Preserve source-line attribution and cover unescaped host-language whitespace and shell-control encodings without matching identifiers or double-escaped literals.

Verification after rebasing onto current upstream main: 531 focused parser/YARA regressions passed. Ruff, format, diff, and IDE lint checks passed.

Signed-off-by: kshitijrajes <[email protected]>
@kshitijrajes
kshitijrajes force-pushed the fix/scanner-parser-yara-regressions branch from 5a5be04 to 7b9faaf Compare October 31, 2026 10:04

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

Approved after rechecking head 7b9faaf1241e3219c883dfd90cef16f9073527a3.

The remaining technical comments are addressed: the nmap rule covers the requested encoded separators and their Unicode/octal forms, with double-escaped negatives and an explicit run_nmap negative control; the ordinary signature preserves source-line attribution. _has_recursive_force_options now documents its GNU/BSD rm semantics and generic callers, and valid BSD/macOS clusters remain covered. The previous concrete quoted-assignment, computed-Make, Tcl quote-ownership, and rm-option regressions retain their expected finding or incomplete-analysis behavior.

Validation: 167 focused parser/YARA regression tests pass; changed-Python Ruff check passes; the earlier concrete reproducers and 30 additional encoded positive/negative probes pass. All six hosted checks, including unit tests and DCO, pass on this exact head. A broader local analyzer run was interrupted; no full local repository-suite or combined scanner-verdict claim is made.

The PR still bundles several fixes. Splitting remains a maintainability suggestion, rather than an outstanding correctness blocker.

@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

The current correction resolves the final encoded-tab finding as well as the earlier parser and location findings. Ready for code approval.

Material findings

All previously required changes are addressed. The current encoded signature explicitly covers tab, other escaped whitespace and command separators, with bare nmap retaining its nonconsuming word boundary. New public static_yara regressions cover the exact tab case, hex/Unicode/octal forms, line locations and double-escaped controls. Reconciled the complete change against the previously assessed source: the quoted-assignment safety restriction, independent executable-wrapper scan, removal of the computed-Make exemption, hardware-apostrophe correction and BSD/macOS rm clusters remain unchanged and tested. No new required change found.

PIC tradeoffs

Ambiguous Make and mixed hardware/shell ownership retain partial accounting. Encoded YARA recognition remains a bounded lexical signature rather than a general host-language evaluator.

Verification and gaps

Read the full current diff in conjunction with the prior complete assessment, pinned production paths and every changed regression. Compared all four changed files with the previous pinned blobs; the new substantive delta is the expanded encoded-separator signature/tests, plus the rm helper docstring. Rechecked every prior review and resolved thread. All six exact-head hosted checks succeeded. No contributor code, tests, snippets, imports, builds, model calls or scanner invocations were executed.

Reviewed head: 7b9faaf1241e3219c883dfd90cef16f9073527a3.

@rng1995
rng1995 merged commit 3f03a96 into NVIDIA:main Oct 31, 2026
6 checks passed
kshitijrajes added a commit to kshitijrajes/SkillSpector that referenced this pull request Nov 1, 2026
Complete inline-code spans before prose possessives were misread as
unresolved shell quotes, producing static_parse_limit. Fenced blocks
indented relative to a proven list container were also left unowned
despite being valid Markdown.

Reuse bounded inline-delimiter pairing for same-line prose classification
and recognize fences only within CommonMark's 0-3 container-relative
indentation, for top-level and nested list items alike, keeping the
typed-fence label and literal-apostrophe state.

Preserve runtime-command ownership when inline payloads can reach
destructive operands. An inert list marker (-, +, 1., 1)) owns only the
initial command position, and only when no unquoted shell control operator
precedes the inline span, sits between spans, or appears inside the span;
any such operator retains the runtime guard for the following clause. A
leading * is a shell glob, so it never owns the command position.

Keep inline and fenced payloads visible to security rules. Incomplete
spans, runtime-selected clauses, and malformed four-column relative fence
indentation remain fail-closed.

Verification after rebasing onto current upstream main (including NVIDIA#902
and NVIDIA#947): the four analyzer test modules pass (552 tests). A 3,220-variant
differential against main finds no case that moves from COMPLETED to
PARTIAL and none where a control operator clears the parse-limit result.
CLI-based tests only pass locally with click < 8.2 output semantics; the
remaining local failures are the same stderr-in-output failures present on
main. Ruff check and format pass.

Signed-off-by: kshitijrajes <[email protected]>
rng1995 pushed a commit that referenced this pull request Nov 2, 2026
* fix(markdown): preserve bounded inline and list-fence ownership

Complete inline-code spans before prose possessives were misread as
unresolved shell quotes, producing static_parse_limit. Fenced blocks
indented relative to a proven list container were also left unowned
despite being valid Markdown.

Reuse bounded inline-delimiter pairing for same-line prose classification
and recognize fences only within CommonMark's 0-3 container-relative
indentation, for top-level and nested list items alike, keeping the
typed-fence label and literal-apostrophe state.

Preserve runtime-command ownership when inline payloads can reach
destructive operands. An inert list marker (-, +, 1., 1)) owns only the
initial command position, and only when no unquoted shell control operator
precedes the inline span, sits between spans, or appears inside the span;
any such operator retains the runtime guard for the following clause. A
leading * is a shell glob, so it never owns the command position.

Keep inline and fenced payloads visible to security rules. Incomplete
spans, runtime-selected clauses, and malformed four-column relative fence
indentation remain fail-closed.

Verification after rebasing onto current upstream main (including #902
and #947): the four analyzer test modules pass (552 tests). A 3,220-variant
differential against main finds no case that moves from COMPLETED to
PARTIAL and none where a control operator clears the parse-limit result.
CLI-based tests only pass locally with click < 8.2 output semantics; the
remaining local failures are the same stderr-in-output failures present on
main. Ruff check and format pass.

Signed-off-by: kshitijrajes <[email protected]>

* fix(markdown): keep runtime guard when operand lookahead is clipped

The inline runtime-command guard searched only the first 8,192 characters
after a span for destructive operands and treated absence there as proof
that the guard was unnecessary. With `$CMD` in an inline span before a
prose possessive and the closing apostrophe plus `-rf /` placed beyond
that bound, the prose reading masked the apostrophe and cleared the
static_parse_limit result that _bounded_shell_tokens had preserved.

Treat a clipped evidence window as unproved: when the window ends before
the content does, the guard is retained. Windows reaching the end of the
content are judged exactly as before, and proven inert list positions keep
their precision. The guard only runs with complete context, where content
is the whole artifact, so window fragments cannot shorten the bound.

Add a regression with 2,300 lines or words of padding before
`probe' -rf /`, plus a list-marker control that stays COMPLETED.

Verification:
- New regression fails on c462a4e and passes with this change.
- Full suite: the same 583 tests fail with and without this change
  (local click >= 8.2 stderr-in-output and environment failures; CI is
  green on c462a4e); 4 additional tests pass, all of them new.
- 10,080-variant differential (list markers, inline spans, possessives,
  padding around the bound, destructive and benign tails) against
  c462a4e: 1,180 COMPLETED -> PARTIAL, none PARTIAL -> COMPLETED, no
  finding gained or lost. Against 6d0b7c8 (pre-PR): no finding gained or
  lost.
- A real `rm -rf /` (bare, list item, or fenced) still yields TM1. A
  fenced `rm -rf /` beyond the bound after a non-list `$CMD` span is
  PARTIAL again, as on 6d0b7c8.
- Ruff check and format pass; mypy output is unchanged from c462a4e.

Signed-off-by: kshitijrajes <[email protected]>

---------

Signed-off-by: kshitijrajes <[email protected]>
rng1995 pushed a commit that referenced this pull request Nov 2, 2026
Prevent documentation false positives without granting unsafe ownership to executable shell content.

Keep quoted assignment arguments conservative when they contain shell clauses, decode and inspect destructive executable command strings, and recognize valid GNU/BSD/macOS rm option clusters without treating invalid one-dash words as options.

Require whole-fence ownership consistency before masking hardware apostrophes. Mixed HDL literals and shell quotes now fail closed, while proven hardware-only fences remain complete.

Remove the computed Make exemption because unresolved selectors and operands can execute recursively expanded functions and cannot be proven safe locally.

Use separate non-consuming command-token and encoded-separator nmap signatures. Preserve source-line attribution and cover unescaped host-language whitespace and shell-control encodings without matching identifiers or double-escaped literals.

Verification after rebasing onto current upstream main: 531 focused parser/YARA regressions passed. Ruff, format, diff, and IDE lint checks passed.

Signed-off-by: kshitijrajes <[email protected]>
(cherry picked from commit 3f03a96)
Signed-off-by: Narendran Raghavan <[email protected]>
rng1995 pushed a commit that referenced this pull request Nov 2, 2026
* fix(markdown): preserve bounded inline and list-fence ownership

Complete inline-code spans before prose possessives were misread as
unresolved shell quotes, producing static_parse_limit. Fenced blocks
indented relative to a proven list container were also left unowned
despite being valid Markdown.

Reuse bounded inline-delimiter pairing for same-line prose classification
and recognize fences only within CommonMark's 0-3 container-relative
indentation, for top-level and nested list items alike, keeping the
typed-fence label and literal-apostrophe state.

Preserve runtime-command ownership when inline payloads can reach
destructive operands. An inert list marker (-, +, 1., 1)) owns only the
initial command position, and only when no unquoted shell control operator
precedes the inline span, sits between spans, or appears inside the span;
any such operator retains the runtime guard for the following clause. A
leading * is a shell glob, so it never owns the command position.

Keep inline and fenced payloads visible to security rules. Incomplete
spans, runtime-selected clauses, and malformed four-column relative fence
indentation remain fail-closed.

Verification after rebasing onto current upstream main (including #902
and #947): the four analyzer test modules pass (552 tests). A 3,220-variant
differential against main finds no case that moves from COMPLETED to
PARTIAL and none where a control operator clears the parse-limit result.
CLI-based tests only pass locally with click < 8.2 output semantics; the
remaining local failures are the same stderr-in-output failures present on
main. Ruff check and format pass.

Signed-off-by: kshitijrajes <[email protected]>

* fix(markdown): keep runtime guard when operand lookahead is clipped

The inline runtime-command guard searched only the first 8,192 characters
after a span for destructive operands and treated absence there as proof
that the guard was unnecessary. With `$CMD` in an inline span before a
prose possessive and the closing apostrophe plus `-rf /` placed beyond
that bound, the prose reading masked the apostrophe and cleared the
static_parse_limit result that _bounded_shell_tokens had preserved.

Treat a clipped evidence window as unproved: when the window ends before
the content does, the guard is retained. Windows reaching the end of the
content are judged exactly as before, and proven inert list positions keep
their precision. The guard only runs with complete context, where content
is the whole artifact, so window fragments cannot shorten the bound.

Add a regression with 2,300 lines or words of padding before
`probe' -rf /`, plus a list-marker control that stays COMPLETED.

Verification:
- New regression fails on c462a4e and passes with this change.
- Full suite: the same 583 tests fail with and without this change
  (local click >= 8.2 stderr-in-output and environment failures; CI is
  green on c462a4e); 4 additional tests pass, all of them new.
- 10,080-variant differential (list markers, inline spans, possessives,
  padding around the bound, destructive and benign tails) against
  c462a4e: 1,180 COMPLETED -> PARTIAL, none PARTIAL -> COMPLETED, no
  finding gained or lost. Against 6d0b7c8 (pre-PR): no finding gained or
  lost.
- A real `rm -rf /` (bare, list item, or fenced) still yields TM1. A
  fenced `rm -rf /` beyond the bound after a non-list `$CMD` span is
  PARTIAL again, as on 6d0b7c8.
- Ruff check and format pass; mypy output is unchanged from c462a4e.

Signed-off-by: kshitijrajes <[email protected]>

---------

Signed-off-by: kshitijrajes <[email protected]>
(cherry picked from commit 6ce47f3)
Signed-off-by: Narendran Raghavan <[email protected]>
yashrajp22 pushed a commit that referenced this pull request Nov 4, 2026
Prevent documentation false positives without granting unsafe ownership to executable shell content.

Keep quoted assignment arguments conservative when they contain shell clauses, decode and inspect destructive executable command strings, and recognize valid GNU/BSD/macOS rm option clusters without treating invalid one-dash words as options.

Require whole-fence ownership consistency before masking hardware apostrophes. Mixed HDL literals and shell quotes now fail closed, while proven hardware-only fences remain complete.

Remove the computed Make exemption because unresolved selectors and operands can execute recursively expanded functions and cannot be proven safe locally.

Use separate non-consuming command-token and encoded-separator nmap signatures. Preserve source-line attribution and cover unescaped host-language whitespace and shell-control encodings without matching identifiers or double-escaped literals.

Verification after rebasing onto current upstream main: 531 focused parser/YARA regressions passed. Ruff, format, diff, and IDE lint checks passed.

Signed-off-by: kshitijrajes <[email protected]>
(cherry picked from commit 3f03a96)
Signed-off-by: yashrajbasav <[email protected]>
yashrajp22 pushed a commit that referenced this pull request Nov 4, 2026
* fix(markdown): preserve bounded inline and list-fence ownership

Complete inline-code spans before prose possessives were misread as
unresolved shell quotes, producing static_parse_limit. Fenced blocks
indented relative to a proven list container were also left unowned
despite being valid Markdown.

Reuse bounded inline-delimiter pairing for same-line prose classification
and recognize fences only within CommonMark's 0-3 container-relative
indentation, for top-level and nested list items alike, keeping the
typed-fence label and literal-apostrophe state.

Preserve runtime-command ownership when inline payloads can reach
destructive operands. An inert list marker (-, +, 1., 1)) owns only the
initial command position, and only when no unquoted shell control operator
precedes the inline span, sits between spans, or appears inside the span;
any such operator retains the runtime guard for the following clause. A
leading * is a shell glob, so it never owns the command position.

Keep inline and fenced payloads visible to security rules. Incomplete
spans, runtime-selected clauses, and malformed four-column relative fence
indentation remain fail-closed.

Verification after rebasing onto current upstream main (including #902
and #947): the four analyzer test modules pass (552 tests). A 3,220-variant
differential against main finds no case that moves from COMPLETED to
PARTIAL and none where a control operator clears the parse-limit result.
CLI-based tests only pass locally with click < 8.2 output semantics; the
remaining local failures are the same stderr-in-output failures present on
main. Ruff check and format pass.

Signed-off-by: kshitijrajes <[email protected]>

* fix(markdown): keep runtime guard when operand lookahead is clipped

The inline runtime-command guard searched only the first 8,192 characters
after a span for destructive operands and treated absence there as proof
that the guard was unnecessary. With `$CMD` in an inline span before a
prose possessive and the closing apostrophe plus `-rf /` placed beyond
that bound, the prose reading masked the apostrophe and cleared the
static_parse_limit result that _bounded_shell_tokens had preserved.

Treat a clipped evidence window as unproved: when the window ends before
the content does, the guard is retained. Windows reaching the end of the
content are judged exactly as before, and proven inert list positions keep
their precision. The guard only runs with complete context, where content
is the whole artifact, so window fragments cannot shorten the bound.

Add a regression with 2,300 lines or words of padding before
`probe' -rf /`, plus a list-marker control that stays COMPLETED.

Verification:
- New regression fails on c462a4e and passes with this change.
- Full suite: the same 583 tests fail with and without this change
  (local click >= 8.2 stderr-in-output and environment failures; CI is
  green on c462a4e); 4 additional tests pass, all of them new.
- 10,080-variant differential (list markers, inline spans, possessives,
  padding around the bound, destructive and benign tails) against
  c462a4e: 1,180 COMPLETED -> PARTIAL, none PARTIAL -> COMPLETED, no
  finding gained or lost. Against 6d0b7c8 (pre-PR): no finding gained or
  lost.
- A real `rm -rf /` (bare, list item, or fenced) still yields TM1. A
  fenced `rm -rf /` beyond the bound after a non-list `$CMD` span is
  PARTIAL again, as on 6d0b7c8.
- Ruff check and format pass; mypy output is unchanged from c462a4e.

Signed-off-by: kshitijrajes <[email protected]>

---------

Signed-off-by: kshitijrajes <[email protected]>
(cherry picked from commit 6ce47f3)
Signed-off-by: yashrajbasav <[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.

3 participants