Skip to content

fix(ui): link only http(s) URLs in the summary panel and sanitize the editor's final Markdown pass (backport 2.0 #36806) - #36815

Merged
harsh-vador merged 2 commits into
2.0from
fix/safe-urls-editor-sanitize-2.0
Nov 2, 2026
Merged

harsh-vador merged 2 commits into
2.0from
fix/safe-urls-editor-sanitize-2.0

Conversation

@harsh-vador

@harsh-vador harsh-vador commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

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 setEditorContent ran a final Markdown conversion whose output was never sanitized.

2.0 doesn't have #34070, so it has no getSafeHttpUrl. Its CommonEntitySummaryInfoV1 renders an antd-era <a>/react-router Link rather than the core Button, and its quick-link handling is inline in SearchClassBase.getEntityLink. So this is a re-implementation on 2.0's structure, not a cherry-pick.

What changes

  • StringUtils.getSafeHttpUrl: added, identical to main's, with main's tests.
  • CommonEntitySummaryInfoV1: for isExternal rows, the URL goes through getSafeHttpUrl before it reaches the new-tab <a href> or the - fallback Link to. A non-http(s) URL renders an <a> with no href, or a Link to the current page.
  • SearchClassBase.getEntityLink: a quick link's URL goes through getSafeHttpUrl and 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 through getSanitizeContent, and the image transform parses with DOMParser.

Tests

  • Added getSafeHttpUrl cases to StringUtils.test.ts, a CommonEntitySummaryInfoV1 case for javascript:, mixed-case and data: URLs, a quick-link case to SearchClassBase.test.ts, and fix(ui): link only http(s) URLs in the summary panel and sanitize the editor's final Markdown pass #36806's two BlockEditorUtils cases.
  • The changed test files: 5 suites, 235 tests pass.
  • Callers (summary panel, Explore, search, AppBar, block editor, rich text editor, activity feed, descriptions, sanitize, feed utils): 90 suites, 1138 tests pass.
  • Negative control: with the three source files reverted to origin/2.0, the 7 new summary-panel, quick-link and editor cases fail.
  • eslint: 0 errors (2 warnings on untouched lines). tsc --noEmit: 0 errors.
  • Not run locally: Playwright. It runs in this PR's CI.

🤖 Generated with Claude Code

@harsh-vador harsh-vador added UI UI specific issues safe to test Add this label to run secure Github workflows on PRs labels Nov 2, 2026
@harsh-vador
harsh-vador requested a review from a team as a code owner November 2, 2026 06:55
@harsh-vador
harsh-vador requested review from Rohit0301 and removed request for a team November 2, 2026 06:55
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 skip-pr-checks label.

@gitar-bot

gitar-bot Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
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 getSafeHttpUrl to the summary panel, quick-link search hits, and setEditorContent. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 68%
68.53% (83364/121637) 53.51% (51786/96764) 54.2% (15380/28376)

@sonarqubecloud

sonarqubecloud Bot commented Nov 2, 2026

Copy link
Copy Markdown

@harsh-vador
harsh-vador merged commit f50ea5b into 2.0 Nov 2, 2026
85 of 101 checks passed
@harsh-vador
harsh-vador deleted the fix/safe-urls-editor-sanitize-2.0 branch November 2, 2026 10:52

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants