fix(Markdown): reject all data: schemes in parser isSafeUrl (#6323) - #6355
Open
ManoharPaturi wants to merge 1 commit into
Open
ManoharPaturi wants to merge 1 commit into
ManoharPaturi wants to merge 1 commit into
Conversation
Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
ManoharPaturi
requested review from
cixzhang,
imdreamrunner and
josephfarina
as code owners
September 17, 2026 06:53
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: 36 accessibility violation(s) found — 2 critical, 34 serious. Button pattern - 1 issue(s)
ChatComposer - 1 issue(s)
ChatComposerInput - 1 issue(s)
ChatReasoning - 1 issue(s)
ChatToolCalls - 1 issue(s)
Checkbox pattern - 1 issue(s)
CheckboxList - 1 issue(s)
ClickableCard - 1 issue(s)
CodeEditor - 1 issue(s)
CodeEditorPerf - 1 issue(s)
CodeEditorTheme - 1 issue(s)
CodeTheme - 1 issue(s)
DateRangeInput - 1 issue(s)
FileInput - 1 issue(s)
GridMasonry - 1 issue(s)
Heading - 1 issue(s)
Icon - 1 issue(s)
LogStream - 1 issue(s)
MediaTheme Auto - 1 issue(s)
PowerSearch - 1 issue(s)
ProgressBar - 1 issue(s)
Radio group pattern - 1 issue(s)
RadioList - 1 issue(s)
RichTextEditor - 2 issue(s)
SelectableCard - 1 issue(s)
Stepper - 1 issue(s)
TableGroupedRows - 1 issue(s)
TableTree - 1 issue(s)
Text - 1 issue(s)
Theme - 1 issue(s)
PopArt - 1 issue(s)
Thumbnail - 1 issue(s)
Timestamp - 1 issue(s)
Token - 1 issue(s)
Tokenizer - 1 issue(s)
Visual RegressionStatus: No visual change across 4 compared shot(s). Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
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.
Closes #6323
Summary
The doc comment on
isSafeUrlinpackages/core/src/Markdown/parser.tsstates:However,
isSafeUrlwas previously only testinglower.startsWith('data:text/html'). This allowed arbitrary other dangerous data schemes (such asdata:image/svg+xml,<svg onload=alert(1)>) to pass through the public parser and appear as link/image nodes in the AST.In contrast, the renderer's
sanitizeUrlinMarkdown.tsxusesDANGEROUS_URL_PATTERN = /^(javascript|data|vbscript):/i, which rejects alldata:URLs.Changes
isSafeUrlinpackages/core/src/Markdown/parser.tsto reject alldata:schemes withlower.startsWith('data:'), aligning the parser implementation with its documented contract and withMarkdown.tsx.isSafeUrlfrompackages/core/src/Markdown/parser.tsfor testability and public consumer verification.packages/core/src/Markdown/parser.test.tscovering:isSafeUrlfordata:image/svg+xml,data:image/png,data:text/plain, anddata:text/html.data:image/svg+xmllinks anddata:image/pngimages inparseInline(preserved as literal text)..changeset/fix-markdown-parser-is-safe-url-data.md.Verification
bun test packages/core/src/Markdown/parser.test.tspassed: 144 passed, 0 failed.bunx prettier --checkpassed on all modified files.