Skip to content

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

Merged
harsh-vador merged 5 commits into
mainfrom
fix/summary-panel-safe-urls
Nov 2, 2026
Merged

harsh-vador merged 5 commits into
mainfrom
fix/summary-panel-safe-urls

Conversation

@harsh-vador

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

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #36804
Fixes #36805
Fixes 8379

Two small UI hardening fixes, one commit each.

1. Only link http(s) URLs in the summary panel and quick-link search hits (#36804)

The Explore summary panel's external URL rows and the link of a Context Center quick-link search hit now accept only http(s) URLs. This is the rule #34070 introduced with getSafeHttpUrl, which the older CommonEntitySummaryInfo and every other quick-link renderer already apply. Anything else renders as plain text.

  • CommonEntitySummaryInfoV1: for isExternal rows, the URL goes through getSafeHttpUrl before it reaches either Button branch: the new-tab link, and the same-window link used when the row text is -. This covers the pipeline, dashboard and chart URL rows, the ML model server row and the API collection/endpoint URL rows. Internal rows are unchanged.
  • SearchClassBase.getKnowledgePageEntityLink: a quick link's URL goes through getSafeHttpUrl, and the handler returns '' when it is not http(s). This link feeds the summary panel title, the Explore result card and the global search suggestion.

2. Sanitize the rich text editor's final Markdown conversion (#36805)

Content reaches the editor after formatClientContent has converted and sanitized it, once in the previewer and once in BlockEditor. setEditorContent then converted it a third time without sanitizing. Each conversion removes one level of backslash escaping, so text that stayed inert through the sanitized passes could become markup in the unsanitized one.

  • setEditorContent: the conversion result goes through getSanitizeContent. This is the same sanitizer and config as the earlier passes, and it keeps <#E::…> entity links and block-math-equation. Already-clean content comes out unchanged.
  • transformImgTagsToFileAttachment: parses with DOMParser (text/html) and serializes body, as formatClientContent already does, instead of filling an element of the live document.

Every caller goes through setEditorContent: BlockEditor and RichTextEditor's imperative handle. So this covers descriptions, the rich-text previewers, feed messages, replies and task comments.

Not included: minimatch (Dependabot #818, #819, #820)

An earlier revision bumped the core components' minimatch resolution to 11.0.4, the only fixed line for GHSA-g3hv-75wg-m249. It is reverted here. 11.0 changes Minimatch.set, and the glob@7 inside i18next-json-sync then crashes (Cannot read properties of undefined (reading 'charAt')), which broke yarn check-i18n-all. Pinning ^3 consumers back to 3.1.5 wouldn't close the alert either, since 3.1.5 is also below 11.0.1.

minimatch here is build and lint tooling that only matches repository-authored patterns. The vulnerable optimizationLevel preprocessing exists in 10.x but not in 3.1.5. I suggest dismissing #818 as tolerable risk, and #819/#820 (3.1.5) as inaccurate. #713 (@tiptap/core) needs the editor's tiptap v3 migration.

Type of change:

  • Bug fix

High-level design:

N/A, small changes.

Tests:

Use cases covered

  • An external summary row whose URL is javascript:, mixed-case JaVaScRiPt: or data: renders its text with no href, with a display name and with the - fallback. http(s) rows still open in a new tab with rel="noopener noreferrer".
  • A quick-link search hit with a non-http(s) URL gets an empty link; an https quick link is unchanged.
  • Content that has been through formatClientContent twice and still holds an escaped Markdown image or link with quote-delimited attributes reaches the editor without event-handler attributes. The image still becomes a file attachment and the link keeps its href.
  • transformImgTagsToFileAttachment no longer assigns innerHTML on an element of the live document.

Unit tests

  • Added cases to CommonEntitySummaryInfoV1.test.tsx, SearchClassBase.test.ts and BlockEditorUtils.test.ts.
  • Summary panel and search callers (DataAssetSummaryPanelV1, Explore/EntitySummaryPanel, ExploreV1, ExploreSearchCard, SearchUtils, AppBar, DataAssetSummaryPanelUtils, OverviewSection): 17 suites, 388 tests pass.
  • Editor callers (utils/BlockEditor*, components/BlockEditor, RichTextEditor, ActivityFeed, EntityDescription, sanitize, FeedUtils): 72 suites, 853 tests pass.
  • On the combined branch, the three changed test files plus OverviewSection: 4 suites, 177 tests pass.
  • Negative controls: with only the source files reverted to main, 5 of the new URL tests and both new editor tests fail.
  • eslint (no errors; the warnings are on untouched lines) and prettier are clean on the changed files. tsc --noEmit reports no errors in them.

Backend integration tests

  • Not applicable (no backend API changes).

Playwright (UI) tests

Not run locally. make playwright_affected selects 21 specs for each UI change. They run in this PR's CI.

yarn build && yarn bundle:runtime on this branch passes locally: 151 route chunks load with no unexpected undefined exports. yarn check-i18n-all in core components passes.

Manual testing performed

I ran this branch's UI (vite) against a local server in Chromium (Playwright) and signed in as admin. The test values were written into the API responses in the browser only, so nothing was stored. Each test value sets a flag on window if it runs, and the check reads that flag back.

  1. Explore → Pipelines → a pipeline's summary panel, with the pipeline's sourceUrl set to a javascript: URL and no display name, so the "Pipeline URL" row falls back to -. On this branch the row has no href, and clicking it runs nothing.
  2. A table's details page, with a description that holds an escaped Markdown image carrying an event-handler attribute. On this branch the image becomes a file attachment and no handler runs on load.

Control: I swapped CommonEntitySummaryInfoV1.tsx and BlockEditorUtils.ts back to main under the same server and repeated both steps. The row rendered the javascript: URL as its href and ran it on click, and the description's handler ran on page load. The control screenshots are kept off this public PR.

🤖 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 05:56
@harsh-vador harsh-vador added the safe to test Add this label to run secure Github workflows on PRs label Nov 2, 2026
@harsh-vador
harsh-vador requested a review from Rohit0301 November 2, 2026 05:56
@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:

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.

@harsh-vador harsh-vador changed the title fix(ui): only link http(s) URLs in the summary panel and quick-link search hits fix(ui): link only http(s) URLs, sanitize the editor's final Markdown pass, bump minimatch Nov 2, 2026
@harsh-vador harsh-vador self-assigned this Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ UI Checkstyle passed — lint findings in changed files

🔍 ESLint findings in this PR's files — 0 error(s), 3 warning(s)

Errors block the build. Warnings do not yet — they are rules whose backlog is still
being worked down, listed so this PR does not add to it. See docs/ui-code-quality-gate.md.

0 error(s), 3 warning(s) across 3 changed file(s).

Count Rule
1 react-hooks/exhaustive-deps
1 openmetadata-imports/no-circular-imports
1 openmetadata-imports/no-lower-layer-page-imports
All findings
Location Rule Message
🟡 src/components/common/OverviewSection/CommonEntitySummaryInfoV1.tsx:57:6 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array.
🟡 src/utils/BlockEditorUtils.ts:23:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.
🟡 src/utils/SearchClassBase.ts:62:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.

Fix locally (fast - only checks files changed in this branch):

make ui-checkstyle-changed

@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: 81%
80.93% (136899/169142) 67.83% (49114/72407) 70.88% (27661/39020)

@harsh-vador harsh-vador changed the title fix(ui): link only http(s) URLs, sanitize the editor's final Markdown pass, bump minimatch fix(ui): link only http(s) URLs in the summary panel and sanitize the editor's final Markdown pass Nov 2, 2026
@harsh-vador
harsh-vador enabled auto-merge November 2, 2026 06:55
@harsh-vador

Copy link
Copy Markdown
Contributor Author

2.0 backport: #36815

@gitar-bot

gitar-bot Bot commented Nov 2, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · The HTTP(S) link restriction and final editor sanitization alter rendered content, potentially suppressing legitimate non-HTTP links or Markdown markup.

Restricts external URL rows in the summary panel and quick-link search hits to http(s) URLs, and sanitizes the rich text editor's final Markdown conversion before parsing it outside the live document. 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

@sonarqubecloud

sonarqubecloud Bot commented Nov 2, 2026

Copy link
Copy Markdown

@harsh-vador
harsh-vador added this pull request to the merge queue Nov 2, 2026
harsh-vador added a commit that referenced this pull request Nov 2, 2026
… editor's final Markdown pass (backport 2.0 #36806) (#36815)

* fix(ui): only link http(s) URLs in the summary panel and quick-link search hits (backport 2.0)

* fix(ui): sanitize the editor's final markdown conversion and parse it outside the live document (backport 2.0)
Merged via the queue into main with commit ed0c6ec Nov 2, 2026
69 of 70 checks passed
@harsh-vador
harsh-vador deleted the fix/summary-panel-safe-urls branch November 2, 2026 14:47
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.

Rich text editor should sanitize its final Markdown conversion Summary panel and quick-link search hits should only link http(s) URLs

2 participants