Skip to content

fix(ui): only render http(s) URLs as external link hrefs - #34070

Merged
harsh-vador merged 4 commits into
mainfrom
fix/ui-safe-external-urls
Sep 28, 2026
Merged

harsh-vador merged 4 commits into
mainfrom
fix/ui-safe-external-urls

Conversation

@harsh-vador

Copy link
Copy Markdown
Contributor

Describe your changes

Security scan (collate run 36210692020) flagged two stored-XSS paths where ingested URLs go straight into href:

  • CommonEntitySummaryInfo — external sourceUrl links rendered with href={info.url} and target="_blank" but no rel (XSS via javascript: + tabnabbing).
  • MlModelDetail — ML store storage / imageRepository rendered as raw href.

Fix

  • New getSafeHttpUrl(url) in utils/StringUtils.ts: returns the URL only when it parses as http:/https:, else undefined.
  • The same allowlist was already duplicated in GlossaryTermBadges (getSafeReferenceHref) and PropertyValue (inline isSafeUrl); both now use the shared helper.
  • CommonEntitySummaryInfo: href={getSafeHttpUrl(info.url)} + rel="noopener noreferrer".
  • MlModelDetail: only http(s) values render as links (with rel="noopener noreferrer"); anything else — including s3://… storage paths, which browsers can't open anyway — renders as plain text.

Tests

  • StringUtils.test.ts: accepts http/https; rejects javascript: (incl. mixed case/leading space), data:, ftp:, s3:, empty, invalid.
  • CommonEntitySummaryInfo.test.tsx: asserts rel, and no href for a javascript: URL.
  • MlModelDetail.component.test.tsx: javascript: store value is not a link; https one is, with rel.

Local: jest across the 6 touched suites — 166/166 pass; eslint 0 errors; prettier clean.

Type of change

  • Bug fix (security)

🤖 Generated with Claude Code

Entity summary sourceUrl and ML model storage/imageRepository values
were rendered straight into href, so a stored javascript: URL became a
clickable XSS vector, and the summary link opened target=_blank without
rel=noopener.

Extract the existing protocol allowlist (duplicated in GlossaryTermBadges
and PropertyValue) into getSafeHttpUrl in StringUtils and use it for all
four call sites. Non-http(s) ML store values render as plain text.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@github-actions

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.

@github-actions github-actions Bot added the UI UI specific issues label Sep 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit a04115554c8ce48b87460b72ecd628480200f3a8 in Playwright run 36381381092, attempt 2.

✅ 4618 passed · ❌ 0 failed · 🟡 3 flaky · ⏭️ 1 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 54m 13s

⏱️ Max setup 4m 34s · max shard execution 21m 33s · max shard-job elapsed before upload 25m 9s · reporting 12s

🌐 219.56 requests/attempt · 2.20 app boots/UI scenario · 43.46% common-shard skew

Optimization targets still in progress:

  • Common shard skew was 43.46% (convergence target: at most 15%).
  • Browser traffic was 219.56 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.2 per UI scenario (10773 boots / 4904 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard advanced-search-01 66 0 0 0 0 0
✅ Shard advanced-search-02 64 0 0 0 0 0
✅ Shard chromium-01 129 0 0 0 0 0
✅ Shard chromium-02 145 0 0 0 0 0
✅ Shard chromium-03 151 0 0 1 0 0
✅ Shard chromium-04 122 0 0 0 0 0
✅ Shard chromium-05 141 0 0 0 0 0
🟡 Shard chromium-06 147 0 2 0 0 0
✅ Shard chromium-07 145 0 0 0 0 0
✅ Shard chromium-08 143 0 0 0 0 0
✅ Shard chromium-09 171 0 0 0 0 0
✅ Shard chromium-10 189 0 0 0 0 0
✅ Shard chromium-11 176 0 0 0 0 0
✅ Shard chromium-12 184 0 0 0 0 0
✅ Shard chromium-13 143 0 0 0 0 0
✅ Shard chromium-14 186 0 0 0 0 0
✅ Shard chromium-15 182 0 0 0 0 0
✅ Shard chromium-16 153 0 0 0 0 0
🟡 Shard chromium-17 136 0 1 0 0 0
✅ Shard chromium-18 158 0 0 0 0 0
✅ Shard chromium-19 160 0 0 0 0 0
✅ Shard chromium-20 154 0 0 0 0 0
✅ Shard chromium-21 144 0 0 0 0 0
✅ Shard chromium-22 163 0 0 0 0 0
✅ Shard chromium-23 160 0 0 0 0 0
✅ Shard chromium-24 147 0 0 0 0 0
✅ Shard chromium-25 154 0 0 0 0 0
✅ Shard chromium-26 165 0 0 0 0 0
✅ Shard data-asset-rules-01 65 0 0 0 0 0
✅ Shard domain-isolation-01 16 0 0 0 0 0
✅ Shard global-state-01 34 0 0 0 0 0
✅ Shard import-export-01 32 0 0 0 0 0
✅ Shard import-export-02 92 0 0 0 0 0
✅ Shard import-export-03 26 0 0 0 0 0
✅ Shard ingestion-01 34 0 0 0 0 0
✅ Shard ingestion-02 59 0 0 0 0 0
✅ Shard reindex-01 41 0 0 0 0 0
✅ Shard search-01 12 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0
🟡 3 flaky test(s) (passed on retry)
  • Features/ContextCenterArticles.spec.ts › displayName: switching articles does not bleed unsaved title into next article (shard chromium-06, 1 retry)
  • Features/ContextCenterArticlesFilters.spec.ts › sort options route to the correct data path (shard chromium-06, 1 retry)
  • Features/ContextCenterArticles.spec.ts › Text formatting (shard chromium-17, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@harsh-vador harsh-vador added the safe to test Add this label to run secure Github workflows on PRs label Sep 28, 2026
@harsh-vador harsh-vador self-assigned this Sep 28, 2026
@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 73%
73.59% (107202/145667) 58.81% (65557/111459) 60.09% (21645/36020)

@github-actions

Copy link
Copy Markdown
Contributor

🔄 Playwright impact map auto-refreshed

This PR touched specs or UI source that changed the source→spec routing map. I regenerated .github/playwright/impact-map.generated.json and pushed the diff to this branch.

- source entries: 805 → 805
- 0 added, 0 removed, 1 changed spec-list

Entries whose spec list changed:
  openmetadata-ui/src/main/resources/ui/src/generated/entity/data/topic.ts

What is this file? It is the auto-generated half of Playwright's PR planner. It routes "if source X changes, run specs Y" by walking spec imports and cross-referencing getByTestId strings. Hand-authored routing in impact-map.json always wins on conflict.

What if I want to regenerate locally instead? Run this before pushing your next change to skip the bot commit:

python3 .github/scripts/generate_playwright_impact_map.py
git add .github/playwright/impact-map.generated.json
git commit --amend --no-edit  # or a separate commit

@gitar-bot

gitar-bot Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Restricts multiple UI hrefs to HTTP(S), changing rendering of unsafe URLs.

Fixes stored-XSS vulnerabilities where ingested URLs were rendered directly as href values without validation. Introduces getSafeHttpUrl() utility to allowlist only http: and https: URLs, consolidates duplicate validation logic across CommonEntitySummaryInfo, MlModelDetail, and badge components, and adds rel="noopener noreferrer" to external links. Comprehensive test coverage validates the allowlist and confirms XSS payloads are neutralized.

Review coverage

📋 Rules No rules evaluated

🧪 Functional validation Not enabled · Set up

🤖 Auto-approval Not enabled · Set up

Options

Display: compact → Counting what did not apply, without listing it.

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

Copy link
Copy Markdown
Contributor

⚠️ UI Checkstyle passed — lint findings in changed files

🔍 ESLint findings in this PR's files — 0 error(s), 13 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), 13 warning(s) across 2 changed file(s).

Count Rule
13 react-hooks/exhaustive-deps
All findings
Location Rule Message
🟡 src/components/MlModel/MlModelDetail/MlModelDetail.component.tsx:146:6 react-hooks/exhaustive-deps React Hook useEffect has a missing dependency: 't'. Either include it or remove the dependency array.
🟡 src/components/MlModel/MlModelDetail/MlModelDetail.component.tsx:158:6 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 'currentUser?.id'. Either include it or remove the dependency array.
🟡 src/components/MlModel/MlModelDetail/MlModelDetail.component.tsx:188:6 react-hooks/exhaustive-deps React Hook useEffect has missing dependencies: 'fetchActivityCount' and 'fetchTaskCounts'. Either include them or remove the dependency array.
🟡 src/components/MlModel/MlModelDetail/MlModelDetail.component.tsx:215:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'settingsUpdateHandler'. Either include it or remove the dependency array. If 'settingsUpdateHandler' changes t
🟡 src/components/MlModel/MlModelDetail/MlModelDetail.component.tsx:272:5 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array.
🟡 src/components/MlModel/MlModelDetail/MlModelDetail.component.tsx:292:6 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array.
🟡 src/components/MlModel/MlModelDetail/MlModelDetail.component.tsx:314:6 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array.
🟡 src/components/MlModel/MlModelDetail/MlModelDetail.component.tsx:335:6 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array.
🟡 src/components/MlModel/MlModelDetail/MlModelDetail.component.tsx:346:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'navigate'. Either include it or remove the dependency array.
🟡 src/components/MlModel/MlModelDetail/MlModelDetail.component.tsx:373:6 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 'feedCount'. Either include it or remove the dependency array.
🟡 src/components/MlModel/MlModelDetail/MlModelDetail.component.tsx:413:5 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 'tabs'. Either include it or remove the dependency array.
🟡 src/components/MlModel/MlModelDetail/MlModelDetail.component.tsx:413:6 react-hooks/exhaustive-deps React Hook useMemo has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.
🟡 src/components/common/CustomPropertyTable/PropertyValue.tsx:1195:6 react-hooks/exhaustive-deps React Hook useEffect has missing dependencies: 'isRenderedInRightPanel' and 'propertyType.name'. Either include them or remove the dependency array.

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

make ui-checkstyle-changed

@sonarqubecloud

Copy link
Copy Markdown

@harsh-vador
harsh-vador added this pull request to the merge queue Sep 28, 2026
Merged via the queue into main with commit 3ecf567 Sep 28, 2026
184 of 187 checks passed
@harsh-vador
harsh-vador deleted the fix/ui-safe-external-urls branch September 28, 2026 08:41
Rohit0301 pushed a commit that referenced this pull request Sep 28, 2026
* fix(ui): only render http(s) URLs as external link hrefs

Entity summary sourceUrl and ML model storage/imageRepository values
were rendered straight into href, so a stored javascript: URL became a
clickable XSS vector, and the summary link opened target=_blank without
rel=noopener.

Extract the existing protocol allowlist (duplicated in GlossaryTermBadges
and PropertyValue) into getSafeHttpUrl in StringUtils and use it for all
four call sites. Non-http(s) ML store values render as plain text.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* style(ui): sort StringUtils import in MlModelDetail

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* chore(playwright): auto-refresh impact-map.generated.json

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

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.

3 participants