Skip to content

fix(analyzers): rely on runner for example filtering in E5 and TM4 (close executable bypass)#237

Open
CharmingGroot wants to merge 1 commit into
NVIDIA:mainfrom
CharmingGroot:fix/example-filter-evasion
Open

fix(analyzers): rely on runner for example filtering in E5 and TM4 (close executable bypass)#237
CharmingGroot wants to merge 1 commit into
NVIDIA:mainfrom
CharmingGroot:fix/example-filter-evasion

Conversation

@CharmingGroot

Copy link
Copy Markdown
Contributor

Summary

The SC7 review (#224) established that calling is_code_example() inside an analyzer with an unconditional continue lets a nearby example marker suppress findings in executable files — the shared runner already filters examples in non-executable docs and only downweights executables, so the analyzer-level call is redundant and opens an attacker-controlled bypass. E5 (#218) and TM4 (#220), both merged, use the same pattern. This applies the same fix.

Changes

  • static_patterns_data_exfiltration.py (E5): drop the is_code_example call and import; rely on the runner's file-type-aware handling.
  • static_patterns_tool_misuse.py (TM4): same.
  • Tests: TM4's analyze-level doc-exclusion test is replaced with an executable-evasion test (# for example next to privileged: true still fires); an equivalent E5 regression is added.

Why this is safe

Detection is unchanged — the runner still suppresses non-executable docs and downweights executables. Only the bypass is closed: a # for example near s3.put_object(...) or privileged: true in a .sh/.py no longer evades E5/TM4. anti_refusal already uses a confidence penalty (not a skip), so it is intentionally left as-is.

Testing

make format and make lint pass; the full suite reports 1256 passed, 0 failed. A re-scan confirms detection is preserved (E5 ×2, TM4 ×6 still fire on the same fixtures).

Follows up on the review in #224.

E5 (NVIDIA#218) and TM4 (NVIDIA#220) called is_code_example() with an unconditional continue, letting a nearby example marker (e.g. "# for example") suppress findings in executable files. The shared runner already filters examples in non-executable docs and only downweights executables, so the analyzer-level call was redundant and created an attacker-controlled bypass — the same issue fixed for SC7 in NVIDIA#224. Remove it from both analyzers; replace TM4's analyze-level doc-exclusion test with an executable-evasion test and add the equivalent E5 regression.

Signed-off-by: CharmingGroot <ohyes9711@gmail.com>
@CharmingGroot CharmingGroot force-pushed the fix/example-filter-evasion branch from b1c3657 to 308da53 Compare June 30, 2026 13:53
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