Repository navigation
fix(ui): link only http(s) URLs in the summary panel and sanitize the editor's final Markdown pass (backport 2.0 #36806) - #36815
Conversation
…earch hits (backport 2.0)
… outside the live document (backport 2.0)
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
Code Review ✅ Approved🔴 High risk · HTTP(S)-only links and final Markdown sanitization alter XSS defenses; gaps could let untrusted URLs or markup execute in the UI. Ports the http(s)-only URL check and editor Markdown sanitization fix to the 2.0 branch, adding VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|



Issue
Fixes #36804
Fixes #36805
Fixes 8379
Port of PR #36806 to the 2.0 release branch. PR #36806 explains both problems. In short: the summary panel's external URL rows and quick-link search hits put a stored URL into a link with no scheme check, and
setEditorContentran a final Markdown conversion whose output was never sanitized.2.0 doesn't have #34070, so it has no
getSafeHttpUrl. ItsCommonEntitySummaryInfoV1renders an antd-era<a>/react-routerLinkrather than the coreButton, and its quick-link handling is inline inSearchClassBase.getEntityLink. So this is a re-implementation on 2.0's structure, not a cherry-pick.What changes
StringUtils.getSafeHttpUrl: added, identical tomain's, withmain's tests.CommonEntitySummaryInfoV1: forisExternalrows, the URL goes throughgetSafeHttpUrlbefore it reaches the new-tab<a href>or the-fallbackLink to. A non-http(s) URL renders an<a>with nohref, or aLinkto the current page.SearchClassBase.getEntityLink: a quick link's URL goes throughgetSafeHttpUrland becomes''when it is not http(s).setEditorContent/transformImgTagsToFileAttachment: identical to fix(ui): link only http(s) URLs in the summary panel and sanitize the editor's final Markdown pass #36806. The conversion result goes throughgetSanitizeContent, and the image transform parses withDOMParser.Tests
getSafeHttpUrlcases toStringUtils.test.ts, aCommonEntitySummaryInfoV1case forjavascript:, mixed-case anddata:URLs, a quick-link case toSearchClassBase.test.ts, and fix(ui): link only http(s) URLs in the summary panel and sanitize the editor's final Markdown pass #36806's twoBlockEditorUtilscases.origin/2.0, the 7 new summary-panel, quick-link and editor cases fail.tsc --noEmit: 0 errors.🤖 Generated with Claude Code