Skip to content

fix(dataProducts): guard ODPS import from a product page on productID (2.0) - #37019

Merged
sonika-shah merged 2 commits into
2.0from
fix/odps-guard-productid-2.0
Nov 5, 2026
Merged

sonika-shah merged 2 commits into
2.0from
fix/odps-guard-productid-2.0

Conversation

@sonika-shah

@sonika-shah sonika-shah commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Follow-up to #34193 on 2.0. The same change is on #33993 for main.

Summary

#34193 made ODPS import pick the target data product by productID, but the import modal's guard on a data product page still compared the ODPS name (the display label). So from product A's page:

  • a YAML with A's name but another productID passed the guard and updated that other product, or created a new one;
  • re-importing A's export with an edited display name was blocked, even though its productID is A's.

The guard now reads product.details.<lang>.productID (en, else the first language, as the backend does). It accepts the YAML only when the productID exactly equals the product's FQN or name.

What changed

  • ODPSImportModal.component.tsx: guard on productID instead of name.
  • odps-yaml-name-* messages (all locales) now refer to productID.
  • DataProductODPS.spec.ts: the guard tests now give name and productID different values, and a new test checks that re-importing with an edited display name updates the same product.

Fixes #33995

The import resolves the target product by productID, but the modal guard
still compared the ODPS display name, so a YAML whose name matched the
current product could update (or create) a different one, and a re-import
with an edited display name was blocked. Compare productID against the
product FQN/name (or its sanitized slug, the backend fallback) instead.
@sonika-shah
sonika-shah requested a review from a team as a code owner November 4, 2026 06:46
@sonika-shah sonika-shah added UI UI specific issues safe to test Add this label to run secure Github workflows on PRs labels Nov 4, 2026
@sonika-shah
sonika-shah requested review from sweta1308 and removed request for a team November 4, 2026 06:46
@github-actions

github-actions Bot commented Nov 4, 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.

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 68%
68.61% (83585/121815) 53.66% (52008/96913) 54.3% (15426/28404)

@gitar-bot

gitar-bot Bot commented Nov 4, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 closed / 1 findings

🔴 High risk · Changing the ODPS import guard to productID matching could let an identifier mismatch route imports to another product and overwrite its metadata.

Guards the ODPS import modal on a data product page by productID instead of the display name, so YAML for another product is rejected and re-importing an export with an edited display name updates the same product. The sanitized-match fallback that let a sibling product's productID bypass the guard has been resolved.

✅ 1 closed
✅ Bug: Sanitized-match fallback lets a sibling product's productID bypass guard

📄 openmetadata-ui/src/main/resources/ui/src/components/DataProducts/ODPSImportModal/ODPSImportModal.component.tsx:63-75 📄 openmetadata-ui/src/main/resources/ui/src/components/DataProducts/ODPSImportModal/ODPSImportModal.component.tsx:173-178
The guard accepts the YAML when sanitizeProductId(yamlProductId) === existingDataProduct.name. The backend does not resolve the target that way. mergeOrCreateDataProductFromODPS (DataProductResource.java) first calls findExistingByName(selectProductId(...)) with the raw productID, and only tries the sanitized slug if that lookup finds nothing.

Example: data product names may contain spaces (the backend comment uses "Customer 360"). Products Customer 360 and Customer_360 both exist. On the Customer_360 page, a user imports the YAML exported from Customer 360, which has productID: "Customer 360". That value sanitizes to Customer_360, so the guard lets it through. The backend then finds Customer 360 by its raw FQN and merges or replaces into that sibling product. This is the overwrite of a different product that this PR is meant to stop.

Fix: when the raw productID is not exactly this product's FQN or name, look it up before accepting the sanitized match (e.g. getDataProductByName(yamlProductId)), and block if it resolves to a different product id. Only accept the sanitized match on a 404. Or drop the sanitized fallback and require an exact FQN/name match. Please also add a Playwright case with two products like the ones above.

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 4, 2026

Copy link
Copy Markdown

@sonika-shah
sonika-shah merged commit 2a12528 into 2.0 Nov 5, 2026
84 of 92 checks passed
@sonika-shah
sonika-shah deleted the fix/odps-guard-productid-2.0 branch November 5, 2026 07:15

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

backend 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