fix(parser, security): address remaining adversarial audit findings for single-quote data-line, nesting fast-path, and emoji tags (H-3, M-1, M-2, L-1) - #96
Merged
Conversation
…H-3, M-1, M-2, L-1) - H-3: structuralDiff.ts — support single-quoted data-line attributes in tokenization and normalization - M-1: structuralDiff.ts — add hasDiffNesting fast-path check to avoid O(N*M) lookahead regex on documents without nested diff tags - M-2: domUtils.ts, structuralDiff.ts — use quote-aware iterative stripHtmlTags in verifyDiffIntegrity - L-1: obsidianPlugin.ts — support Extended_Pictographic emojis in Obsidian tag regex and add test
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
Addresses remaining findings (H-3, M-1, M-2, L-1) from the adversarial code audit:
data-lineattribute support (src/markdown/structuralDiff.ts)replaceLineAttributesWithTokens,maskBlockAttributes,createToken, andstripDataLineAttributesto accept both double and single quotes (data-line='...').flattenDiffNesting(src/markdown/structuralDiff.ts)hasDiffNesting(html)linear depth-tracking scanner.<del>/<ins>tags, eliminatingverifyDiffIntegrity(src/markdown/domUtils.ts,src/markdown/structuralDiff.ts)stripHtmlTags(input, replacement = "")with an optional replacement string parameter.verifyDiffIntegrityto use iterative quote-awarestripHtmlTags(html, " ")instead of a single-pass regex, preventing bypasses from nested tags or attribute values containing>.src/markdown/obsidianPlugin.ts)\p{Extended_Pictographic}, allowing tags starting with or containing Unicode emojis (e.g.#🚀,#🚀launch,#project/🔥/task).src/test/unit/obsidianPlugin.test.ts.Verification
pnpm run compilepassed.pnpm run lintpassed.pnpm run test:unitpassed (279 passing tests).