fix(security): regex-audit missing inline-literal detection for .ts/.tsx/.jsx/.mjs/.cjs#212
Merged
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…tsx/.jsx/.mjs/.cjs Only .js had the 'regex_literal_inline' pattern (bare /pattern/flags used directly as a call argument, e.g. .replace(/[-:T]/g, '')). Every other JS family extension — .mjs, .cjs, .ts, .tsx, .jsx — was missing it, so any inline (non-variable-assigned) regex literal in TypeScript/JSX went completely undetected. Found via real-codebase validation (Coretax-Auto-Downloader KDS backend, all .ts): regex-audit reported total_patterns:0 despite genuine inline regex literals (.replace(/[-:T]/g, ''), .replace(/\s+/g, '.')) confirmed present via grep. Fix: add the same inline-literal pattern already used for .js to the other 4 extensions. Verified: total_patterns went from 0 to 1735, vulnerable stayed 0 (no ReDoS-prone patterns in this codebase) — the inline pattern is inherently noisy for raw counting (same tradeoff .js already accepted), but doesn't affect the vulnerability-flagging logic.
|
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 regex-auditagainst KDS backend (all .ts files) — reportedtotal_patterns: 0despite genuine inline regex literals confirmed via grep (.replace(/[-:T]/g, ''),.replace(/\s+/g, '.')).Root cause: only
.jshad theregex_literal_inlinepattern (bare/pattern/flagsused directly as a call argument, not assigned to a variable). Every other JS-family extension (.mjs,.cjs,.ts,.tsx,.jsx) was missing it.Fix: add the same pattern to the other 4 extensions. Verified:
total_patternswent from 0 to 1735,vulnerablestayed 0 (no ReDoS patterns in this codebase) — the inline pattern is noisy for raw counting (matches division operators too, same tradeoff.jsalready accepted) but doesn't affect vulnerability flagging.