Skip to content

Fix high-severity CodeQL findings (ReDoS, double-escaping, fs-race)#57

Merged
MelbourneDeveloper merged 1 commit into
mainfrom
tdbin
Jul 12, 2026
Merged

Fix high-severity CodeQL findings (ReDoS, double-escaping, fs-race)#57
MelbourneDeveloper merged 1 commit into
mainfrom
tdbin

Conversation

@MelbourneDeveloper

Copy link
Copy Markdown
Collaborator

Summary

Fixes the 6 high-severity CodeQL findings that block the release gate (all pre-existing, traced to early commits — not this branch's dedup work). The v0.12.0 Release run failed on Enforce no high/critical findings (release gate); nothing was published.

Rule Location Fix
js/polynomial-redos model/print.ts linear trailing-newline collapse (no \n+$)
js/polynomial-redos integrations/markdown.ts FENCE_RE \s*[ \t\r]* (can't overlap \n); CRLF still matches
js/redos web/highlight-js.ts regex-literal body alternatives made first-char-disjoint; bare ] still highlights
js/double-escaping vscode/webview/main.ts decode & LAST (exact inverse of escapeHtml)
js/file-system-race vscode export-pdf test assert on the written buffer, not a re-read of the path (TOCTOU removed, all assertions kept)

Each fix was adversarially verified: vulnerable construct genuinely removed, behavior identical for valid inputs, and two verifier-caught regressions (bare-] regex literals; CRLF fences) were corrected before commit.

Gates

  • make ci → exit 0 (fmt, ESLint, clippy deny-all, tests + coverage, build, bundle-size)

🤖 Generated with Claude Code

Resolve the 6 findings the release CodeQL gate flags (all pre-existing):
- js/polynomial-redos in model/print.ts: replace /\n+$/ trailing-newline
  collapse with a linear scan
- js/polynomial-redos in integrations/markdown.ts: FENCE_RE's \s* (which
  could match \n) narrowed to [ \t\r]* so it cannot overlap the newline
  boundary; CRLF fences still match
- js/redos in web/highlight-js.ts: make the regex-literal heuristic's body
  alternatives mutually exclusive on first char (no backtracking); bare ']'
  outside a class still highlights
- js/double-escaping in vscode/webview/main.ts: decode & LAST so entity
  decoding is the exact inverse of escapeHtml
- js/file-system-race in vscode export-pdf test: assert on the written buffer
  instead of re-reading the path (removes the TOCTOU; all assertions kept)

make ci green; behavior verified unchanged for valid inputs.
@MelbourneDeveloper
MelbourneDeveloper merged commit 4132630 into main Jul 12, 2026
6 checks passed
@MelbourneDeveloper
MelbourneDeveloper deleted the tdbin branch July 12, 2026 02:15
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