fix(security): resolve CodeQL ReDoS, Marp tag sanitization, and test runner issues - #80
Merged
Merged
Conversation
phine-apps
added a commit
that referenced
this pull request
Aug 30, 2026
…unner fix(security): resolve CodeQL ReDoS, Marp tag sanitization, and test runner issues
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.
Summary
This PR addresses high-priority security alerts reported by GitHub CodeQL (Code Scanning) and fixes the VS Code integration test runner environment.
1. Fix ReDoS in structural diff regexes (
js/redos)footnoteBundleRegexinsrc/markdown/structuralDiff.tsby eliminating nested quantifiers((?:<li[^>]*>[\s\S]*?<\/li>\s*)+)that caused exponential backtracking on long or repeated list items. Guarded the callback to process only valid footnote list bundles without colliding with list container swaps.wrapHeadingPrefixesinsrc/markdown/structuralDiff.tsto use a linear heading matcher and deterministic prefix parser instead of backtracking nested whitespace/quantifier groups.2. Improve Marp script & style sanitization (
js/bad-tag-filter,js/incomplete-multi-character-sanitization)cleanMarpHtmlinsrc/markdown/marpRenderer.tsto use case-insensitive matching with whitespace tolerance (/<\s*script\b[^>]*>([\s\S]*?)<\/\s*script\s*>/gi) to avoid tag bypasses (e.g.</script >, multiline attributes, uppercase tags). Applied iterative loop stripping (do ... while) for complete tag removal.src/test/unit/markdownDiff.test.tsto match case-insensitively with full attribute/whitespace tolerance.3. Fix VS Code integration test runner (
src/test/runTest.ts)ELECTRON_RUN_AS_NODEfromprocess.envbefore callingrunTestsso VS Code launches properly as a GUI Electron app with extension CLI arguments when executed from VS Code integrated terminals or IDE sub-shells.Verification
233 passing (3s)(pnpm test:unit)50 passing (3s)(npm run test)pnpm run test:visual:docker)0 errors