Skip to content

fix(security): taint treesitter_used/regex_fallback stat miscounted clean files#211

Merged
Wolfvin merged 1 commit into
mainfrom
fix/taint-engine-usage-stat-miscounted
Jul 11, 2026
Merged

fix(security): taint treesitter_used/regex_fallback stat miscounted clean files#211
Wolfvin merged 1 commit into
mainfrom
fix/taint-engine-usage-stat-miscounted

Conversation

@Wolfvin

@Wolfvin Wolfvin commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Found while continuing audit of security --check taint against KDS backend.

treesitter_available: true but treesitter_used: 0, regex_fallback: 50 — misleading. Root cause: the stats loop inferred which engine ran from findings[0]['engine'], which needs at least one finding to exist. Any clean file (0 findings) always fell into regex_fallback regardless of which engine actually analyzed it.

Fix: check parser availability directly instead of inferring from finding content. Verified: treesitter_used: 50, regex_fallback: 0 after fix, matching the fact that tree-sitter was available and used for all 50 files (they just had no vulnerabilities).

@Wolfvin Wolfvin merged commit e82440d into main Jul 11, 2026
@Wolfvin Wolfvin deleted the fix/taint-engine-usage-stat-miscounted branch July 11, 2026 18:50
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

…lean files

Stats loop inferred which engine ran from findings[0]['engine'], but this
requires at least one finding to exist. Any clean file (0 findings) has
'if findings' evaluate False regardless of which engine actually analyzed
it, so it always fell into the regex_fallback bucket.

Found via real-codebase validation (Coretax-Auto-Downloader KDS backend,
0 taint findings total): treesitter_available:true but
treesitter_used:0, regex_fallback:50 — misleading, since tree-sitter was
in fact available and used for all 50 files, they just had no findings.

Fix: check parser availability directly (mirrors _analyze_with_treesitter's
own check) instead of inferring from finding content.
@sonarqubecloud

Copy link
Copy Markdown

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