Skip to content

fix(detector): shield multi-line block comments in AST-free extraction - #3261

Merged
squid-protocol merged 3 commits into
mainfrom
fix/3260-ast-free-multiline-comment-shielding
Sep 21, 2026
Merged

squid-protocol merged 3 commits into
mainfrom
fix/3260-ast-free-multiline-comment-shielding

Conversation

@squid-protocol

@squid-protocol squid-protocol commented Sep 21, 2026 •

Copy link
Copy Markdown
Owner

Summary

This PR fixes a critical blind spot in the new AST-free literal shielder where multi-line block comments (e.g. /* ... */) were completely ignored, leaving commented-out code exposed to downstream node extraction.

What was fixed/changed

  • The Bug: The atomic_string_pattern regex in _apply_literal_shield hardcoded its comment matching to [^\n]* (single-line comments only). This meant that functions, strings, or keywords wrapped inside a /* ... */ block comment were still leaking through and triggering false positive extractions.
  • The Fix: Dynamically injected a block_comment_alt matcher into the atomic_string_pattern. It defaults to the standard /* ... */ regex for the vast majority of C-family languages, and intelligently pivots to <!-- ... --> for HTML/XML and {- ... -} for Haskell.
  • Impact: This instantly eliminates a massive category of false positives across over a dozen major languages (C, C++, Java, JS, TypeScript, C#, Go, Rust, PHP, Swift, Kotlin, Scala, Dart, Objective-C, CSS, SQL, Groovy, Solidity).
  • Testing: Confirmed via the A/B testing experiment (ab_linux_experiment.py) that a commented-out init_module() function call wrapped in /* ... */ is now successfully blanked out and ignored.

@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 0af623f into main Sep 21, 2026
31 checks passed
@squid-protocol
squid-protocol deleted the fix/3260-ast-free-multiline-comment-shielding branch September 21, 2026 18:56
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