fix(security): taint _detect_languages caused 3x redundant scan + duplicate findings#213
Merged
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…licate findings _detect_languages() appended lang to found[] once per matching FILE, not once per language, because the inner 'break' only exited the marker loop, not the file loop — and the early-exit guard only ran after an entire directory's files were exhausted. Any workspace with 3+ matching files in its first walked directory got that language duplicated N times in the returned list. Since the caller iterates 'languages' and re-runs the ENTIRE taint scan once per entry, this wasn't cosmetic — it caused the whole analysis to run redundantly 3x (or however many dupes existed), tripling scan time and (on a codebase with real findings) would have tripled duplicate findings in the output. Found via real-codebase validation (Coretax-Auto-Downloader smart-tax- assistance app): languages_analyzed returned ["typescript","typescript","typescript"], files_analyzed:303 for a workspace with only 101 actual .ts files. After fix: languages_analyzed ["typescript"], files_analyzed:101 — matches ground truth.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Found while auditing
security --check taintagainst Smart Tax Assistance app (smart-tax-assistance/app/src).languages_analyzedreturned["typescript","typescript","typescript"]andfiles_analyzed: 303for a workspace with only 101 actual.tsfiles — the whole taint scan ran 3x redundantly.Root cause:
_detect_languages()'s innerbreakonly exited the marker-matching loop, not the file loop, and the early-exit guard only checked after an entire directory's files were exhausted. Any workspace with 3+ matching files in the first walked directory got that language duplicated N times in the returned list — and since the caller re-runs the entire scan once per list entry, this wasn't cosmetic: it tripled scan time and (on a codebase with real findings) would have tripled duplicate findings in the output.Verified:
languages_analyzed: ["typescript"],files_analyzed: 101after fix — matches ground truth.