Repository navigation
fix(security,perf): resolve adversarial audit findings across Marp, Mermaid, sanitizer, and structural diff - #110
Merged
Conversation
…ermaid, sanitizer, and structural diff
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
Remediates all 12 findings (Critical, High, Medium, Low) identified during the 6-Pillar Adversarial Code Audit:
Security & Sanitization (Pillar 3)
src/markdown/marpRenderer.tswith exact matching against Marp Core's baseline internal script captured inloadMarp(), and neutralize</scriptinsrc/markdown/webviewTemplate.ts.</style>Breakout (High): Neutralize</stylesequences inscopeMarpCss()andwebviewTemplate.ts(marpCssandkatexCssInline).srcScheme Validation (High): Add"src"toallowedSchemesAppliedToAttributesinsrc/markdown/sanitizer.ts(strippingjavascript:on<img>) while allowingvscode-webview-resourceandvscode-resourceonimg.url()Filter Hardening (Medium): Block CSS backslash escapes,/*comments, andimage-set()/-webkit-image-set()insrc/markdown/sanitizer.ts.allowedRootsviaisPathWithinAllowedRoots()insrc/exportHtml.tsand pass workspace + extensionmedia/dataroots fromsrc/extension.ts.Number.isIntegeron line numbers, writable-scheme allowlist (file:/untitled:) forapplyEdit, and strict type checks forpageandruntimeDiagnosticspayloads insrc/extension.ts.ReDoS & Linear Performance (Pillar 1)
parseMermaidEdges()(src/markdown/mermaidDiff.ts).fixInvalidNestingStep 0 (Medium): Replace quadratic negative-lookahead regex with ansrc/markdown/structuralDiff.ts.HTML Structural Integrity, Line Mapping & CJK/Unicode (Pillars 2, 4, 5)
findClosinginsplitMarpSlides()and backreference\1incleanMarpHtml().maskBlockAttributesandsplitByBlocksquote-aware; handle empty frontmatter, UTF-8 BOM, and matching delimiters ingetLineOffset(); skip leading whitespace ininjectLineNumbers().labelBlockDiffTags(Low): Inspect the immediate child element'sclassattribute to attachdata-diff-label.\u200D) and VS16 (\uFE0F) inobsidian_tag, and use code-point-safe slicing with CJK-aware thresholds for Marp fuzzy heading matching.Verification
./node_modules/.bin/tsc -p ./: Passed (0 errors)npm run lint: Passed (0 errors, 0 warnings)./node_modules/.bin/mocha "./out/test/unit/**/*.test.js": 305 passing (including 11 new adversarial regression tests)