Skip to content

Glossary relations - #25886

Merged
karanh37 merged 64 commits into
mainfrom
glossary_relations
Mar 18, 2026
Merged

karanh37 merged 64 commits into
mainfrom
glossary_relations

Conversation

@harshach

@harshach harshach commented Feb 14, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes:

Fixes

I worked on ... because ...

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.


Summary by Gitar

  • Backend changes:
    • Added glossary term relation types with RDF predicates and symmetric/transitive properties
    • Created GlossaryTermRelationSettings configuration schema with relation metadata
    • Enhanced GlossaryTermRepository and RdfRepository for relation handling
    • Migrated existing RELATED_TO relationships to include relationType field
  • Frontend features:
    • Built new OntologyExplorer component with graph visualization using G6
    • Added GlossaryTermRelationSettings page for managing relation types
    • Updated RelatedTerms component with relation type filtering and display
    • Added internationalization strings for new glossary relation features
  • Testing:
    • Added comprehensive integration tests for glossary term relations, CSV imports, and edge cases
    • Created factory classes and Playwright specs for ontology explorer validation

This will update automatically on new commits.

@github-actions

Copy link
Copy Markdown
Contributor

TypeScript types have been updated based on the JSON schema changes in the PR

@github-actions

github-actions Bot commented Feb 14, 2026 •

Copy link
Copy Markdown
Contributor

🛡️ TRIVY SCAN RESULT 🛡️

Target: openmetadata-ingestion-base-slim:trivy (debian 12.13)

No Vulnerabilities Found

🛡️ TRIVY SCAN RESULT 🛡️

Target: Java

Vulnerabilities (37)

Package Vulnerability ID Severity Installed Version Fixed Version
com.fasterxml.jackson.core:jackson-core CVE-2025-52999 🚨 HIGH 2.12.7 2.15.0
com.fasterxml.jackson.core:jackson-core GHSA-72hv-8253-57qq 🚨 HIGH 2.12.7 2.18.6, 2.21.1, 3.1.0
com.fasterxml.jackson.core:jackson-core CVE-2025-52999 🚨 HIGH 2.13.4 2.15.0
com.fasterxml.jackson.core:jackson-core GHSA-72hv-8253-57qq 🚨 HIGH 2.13.4 2.18.6, 2.21.1, 3.1.0
com.fasterxml.jackson.core:jackson-core GHSA-72hv-8253-57qq 🚨 HIGH 2.15.2 2.18.6, 2.21.1, 3.1.0
com.fasterxml.jackson.core:jackson-databind CVE-2022-42003 🚨 HIGH 2.12.7 2.12.7.1, 2.13.4.2
com.fasterxml.jackson.core:jackson-databind CVE-2022-42004 🚨 HIGH 2.12.7 2.12.7.1, 2.13.4
com.google.code.gson:gson CVE-2022-25647 🚨 HIGH 2.2.4 2.8.9
com.google.protobuf:protobuf-java CVE-2021-22569 🚨 HIGH 3.3.0 3.16.1, 3.18.2, 3.19.2
com.google.protobuf:protobuf-java CVE-2022-3509 🚨 HIGH 3.3.0 3.16.3, 3.19.6, 3.20.3, 3.21.7
com.google.protobuf:protobuf-java CVE-2022-3510 🚨 HIGH 3.3.0 3.16.3, 3.19.6, 3.20.3, 3.21.7
com.google.protobuf:protobuf-java CVE-2024-7254 🚨 HIGH 3.3.0 3.25.5, 4.27.5, 4.28.2
com.google.protobuf:protobuf-java CVE-2021-22569 🚨 HIGH 3.7.1 3.16.1, 3.18.2, 3.19.2
com.google.protobuf:protobuf-java CVE-2022-3509 🚨 HIGH 3.7.1 3.16.3, 3.19.6, 3.20.3, 3.21.7
com.google.protobuf:protobuf-java CVE-2022-3510 🚨 HIGH 3.7.1 3.16.3, 3.19.6, 3.20.3, 3.21.7
com.google.protobuf:protobuf-java CVE-2024-7254 🚨 HIGH 3.7.1 3.25.5, 4.27.5, 4.28.2
com.nimbusds:nimbus-jose-jwt CVE-2023-52428 🚨 HIGH 9.8.1 9.37.2
com.squareup.okhttp3:okhttp CVE-2021-0341 🚨 HIGH 3.12.12 4.9.2
commons-beanutils:commons-beanutils CVE-2025-48734 🚨 HIGH 1.9.4 1.11.0
commons-io:commons-io CVE-2024-47554 🚨 HIGH 2.8.0 2.14.0
dnsjava:dnsjava CVE-2024-25638 🚨 HIGH 2.1.7 3.6.0
io.airlift:aircompressor CVE-2025-67721 🚨 HIGH 0.27 2.0.3
io.netty:netty-codec-http2 CVE-2025-55163 🚨 HIGH 4.1.96.Final 4.2.4.Final, 4.1.124.Final
io.netty:netty-codec-http2 GHSA-xpw8-rcwv-8f8p 🚨 HIGH 4.1.96.Final 4.1.100.Final
io.netty:netty-handler CVE-2025-24970 🚨 HIGH 4.1.96.Final 4.1.118.Final
net.minidev:json-smart CVE-2021-31684 🚨 HIGH 1.3.2 1.3.3, 2.4.4
net.minidev:json-smart CVE-2023-1370 🚨 HIGH 1.3.2 2.4.9
org.apache.avro:avro CVE-2024-47561 🔥 CRITICAL 1.7.7 1.11.4
org.apache.avro:avro CVE-2023-39410 🚨 HIGH 1.7.7 1.11.3
org.apache.derby:derby CVE-2022-46337 🔥 CRITICAL 10.14.2.0 10.14.3, 10.15.2.1, 10.16.1.2, 10.17.1.0
org.apache.ivy:ivy CVE-2022-46751 🚨 HIGH 2.5.1 2.5.2
org.apache.mesos:mesos CVE-2018-1330 🚨 HIGH 1.4.3 1.6.0
org.apache.thrift:libthrift CVE-2019-0205 🚨 HIGH 0.12.0 0.13.0
org.apache.thrift:libthrift CVE-2020-13949 🚨 HIGH 0.12.0 0.14.0
org.apache.zookeeper:zookeeper CVE-2023-44981 🔥 CRITICAL 3.6.3 3.7.2, 3.8.3, 3.9.1
org.eclipse.jetty:jetty-server CVE-2024-13009 🚨 HIGH 9.4.56.v20240826 9.4.57.v20241219
org.lz4:lz4-java CVE-2025-12183 🚨 HIGH 1.8.0 1.8.1

🛡️ TRIVY SCAN RESULT 🛡️

Target: Node.js

No Vulnerabilities Found

🛡️ TRIVY SCAN RESULT 🛡️

Target: Python

Vulnerabilities (10)

Package Vulnerability ID Severity Installed Version Fixed Version
apache-airflow CVE-2025-68438 🚨 HIGH 3.1.5 3.1.6
apache-airflow CVE-2025-68675 🚨 HIGH 3.1.5 3.1.6, 2.11.1
cryptography CVE-2026-26007 🚨 HIGH 42.0.8 46.0.5
jaraco.context CVE-2026-23949 🚨 HIGH 6.0.1 6.1.0
pyOpenSSL CVE-2026-27459 🚨 HIGH 24.1.0 26.0.0
starlette CVE-2025-62727 🚨 HIGH 0.48.0 0.49.1
urllib3 CVE-2025-66418 🚨 HIGH 1.26.20 2.6.0
urllib3 CVE-2025-66471 🚨 HIGH 1.26.20 2.6.0
urllib3 CVE-2026-21441 🚨 HIGH 1.26.20 2.6.3
wheel CVE-2026-24049 🚨 HIGH 0.45.1 0.46.2

🛡️ TRIVY SCAN RESULT 🛡️

Target: /etc/ssl/private/ssl-cert-snakeoil.key

No Vulnerabilities Found

🛡️ TRIVY SCAN RESULT 🛡️

Target: /ingestion/pipelines/extended_sample_data.yaml

No Vulnerabilities Found

🛡️ TRIVY SCAN RESULT 🛡️

Target: /ingestion/pipelines/lineage.yaml

No Vulnerabilities Found

🛡️ TRIVY SCAN RESULT 🛡️

Target: /ingestion/pipelines/sample_data.json

No Vulnerabilities Found

🛡️ TRIVY SCAN RESULT 🛡️

Target: /ingestion/pipelines/sample_data.yaml

No Vulnerabilities Found

🛡️ TRIVY SCAN RESULT 🛡️

Target: /ingestion/pipelines/sample_data_aut.yaml

No Vulnerabilities Found

🛡️ TRIVY SCAN RESULT 🛡️

Target: /ingestion/pipelines/sample_usage.json

No Vulnerabilities Found

🛡️ TRIVY SCAN RESULT 🛡️

Target: /ingestion/pipelines/sample_usage.yaml

No Vulnerabilities Found

🛡️ TRIVY SCAN RESULT 🛡️

Target: /ingestion/pipelines/sample_usage_aut.yaml

No Vulnerabilities Found

@github-actions

github-actions Bot commented Feb 14, 2026 •

Copy link
Copy Markdown
Contributor

🛡️ TRIVY SCAN RESULT 🛡️

Target: openmetadata-ingestion:trivy (debian 12.12)

Vulnerabilities (4)

Package Vulnerability ID Severity Installed Version Fixed Version
libpam-modules CVE-2025-6020 🚨 HIGH 1.5.2-6+deb12u1 1.5.2-6+deb12u2
libpam-modules-bin CVE-2025-6020 🚨 HIGH 1.5.2-6+deb12u1 1.5.2-6+deb12u2
libpam-runtime CVE-2025-6020 🚨 HIGH 1.5.2-6+deb12u1 1.5.2-6+deb12u2
libpam0g CVE-2025-6020 🚨 HIGH 1.5.2-6+deb12u1 1.5.2-6+deb12u2

🛡️ TRIVY SCAN RESULT 🛡️

Target: Java

Vulnerabilities (38)

Package Vulnerability ID Severity Installed Version Fixed Version
com.fasterxml.jackson.core:jackson-core CVE-2025-52999 🚨 HIGH 2.12.7 2.15.0
com.fasterxml.jackson.core:jackson-core GHSA-72hv-8253-57qq 🚨 HIGH 2.12.7 2.18.6, 2.21.1, 3.1.0
com.fasterxml.jackson.core:jackson-core CVE-2025-52999 🚨 HIGH 2.13.4 2.15.0
com.fasterxml.jackson.core:jackson-core GHSA-72hv-8253-57qq 🚨 HIGH 2.13.4 2.18.6, 2.21.1, 3.1.0
com.fasterxml.jackson.core:jackson-core GHSA-72hv-8253-57qq 🚨 HIGH 2.15.2 2.18.6, 2.21.1, 3.1.0
com.fasterxml.jackson.core:jackson-core GHSA-72hv-8253-57qq 🚨 HIGH 2.16.1 2.18.6, 2.21.1, 3.1.0
com.fasterxml.jackson.core:jackson-databind CVE-2022-42003 🚨 HIGH 2.12.7 2.12.7.1, 2.13.4.2
com.fasterxml.jackson.core:jackson-databind CVE-2022-42004 🚨 HIGH 2.12.7 2.12.7.1, 2.13.4
com.google.code.gson:gson CVE-2022-25647 🚨 HIGH 2.2.4 2.8.9
com.google.protobuf:protobuf-java CVE-2021-22569 🚨 HIGH 3.3.0 3.16.1, 3.18.2, 3.19.2
com.google.protobuf:protobuf-java CVE-2022-3509 🚨 HIGH 3.3.0 3.16.3, 3.19.6, 3.20.3, 3.21.7
com.google.protobuf:protobuf-java CVE-2022-3510 🚨 HIGH 3.3.0 3.16.3, 3.19.6, 3.20.3, 3.21.7
com.google.protobuf:protobuf-java CVE-2024-7254 🚨 HIGH 3.3.0 3.25.5, 4.27.5, 4.28.2
com.google.protobuf:protobuf-java CVE-2021-22569 🚨 HIGH 3.7.1 3.16.1, 3.18.2, 3.19.2
com.google.protobuf:protobuf-java CVE-2022-3509 🚨 HIGH 3.7.1 3.16.3, 3.19.6, 3.20.3, 3.21.7
com.google.protobuf:protobuf-java CVE-2022-3510 🚨 HIGH 3.7.1 3.16.3, 3.19.6, 3.20.3, 3.21.7
com.google.protobuf:protobuf-java CVE-2024-7254 🚨 HIGH 3.7.1 3.25.5, 4.27.5, 4.28.2
com.nimbusds:nimbus-jose-jwt CVE-2023-52428 🚨 HIGH 9.8.1 9.37.2
com.squareup.okhttp3:okhttp CVE-2021-0341 🚨 HIGH 3.12.12 4.9.2
commons-beanutils:commons-beanutils CVE-2025-48734 🚨 HIGH 1.9.4 1.11.0
commons-io:commons-io CVE-2024-47554 🚨 HIGH 2.8.0 2.14.0
dnsjava:dnsjava CVE-2024-25638 🚨 HIGH 2.1.7 3.6.0
io.airlift:aircompressor CVE-2025-67721 🚨 HIGH 0.27 2.0.3
io.netty:netty-codec-http2 CVE-2025-55163 🚨 HIGH 4.1.96.Final 4.2.4.Final, 4.1.124.Final
io.netty:netty-codec-http2 GHSA-xpw8-rcwv-8f8p 🚨 HIGH 4.1.96.Final 4.1.100.Final
io.netty:netty-handler CVE-2025-24970 🚨 HIGH 4.1.96.Final 4.1.118.Final
net.minidev:json-smart CVE-2021-31684 🚨 HIGH 1.3.2 1.3.3, 2.4.4
net.minidev:json-smart CVE-2023-1370 🚨 HIGH 1.3.2 2.4.9
org.apache.avro:avro CVE-2024-47561 🔥 CRITICAL 1.7.7 1.11.4
org.apache.avro:avro CVE-2023-39410 🚨 HIGH 1.7.7 1.11.3
org.apache.derby:derby CVE-2022-46337 🔥 CRITICAL 10.14.2.0 10.14.3, 10.15.2.1, 10.16.1.2, 10.17.1.0
org.apache.ivy:ivy CVE-2022-46751 🚨 HIGH 2.5.1 2.5.2
org.apache.mesos:mesos CVE-2018-1330 🚨 HIGH 1.4.3 1.6.0
org.apache.thrift:libthrift CVE-2019-0205 🚨 HIGH 0.12.0 0.13.0
org.apache.thrift:libthrift CVE-2020-13949 🚨 HIGH 0.12.0 0.14.0
org.apache.zookeeper:zookeeper CVE-2023-44981 🔥 CRITICAL 3.6.3 3.7.2, 3.8.3, 3.9.1
org.eclipse.jetty:jetty-server CVE-2024-13009 🚨 HIGH 9.4.56.v20240826 9.4.57.v20241219
org.lz4:lz4-java CVE-2025-12183 🚨 HIGH 1.8.0 1.8.1

🛡️ TRIVY SCAN RESULT 🛡️

Target: Node.js

No Vulnerabilities Found

🛡️ TRIVY SCAN RESULT 🛡️

Target: Python

Vulnerabilities (29)

Package Vulnerability ID Severity Installed Version Fixed Version
Authlib CVE-2026-27962 🔥 CRITICAL 1.6.6 1.6.9
Authlib CVE-2026-28490 🚨 HIGH 1.6.6 1.6.9
Authlib CVE-2026-28498 🚨 HIGH 1.6.6 1.6.9
Authlib CVE-2026-28802 🚨 HIGH 1.6.6 1.6.7
PyJWT CVE-2026-32597 🚨 HIGH 2.10.1 2.12.0
Werkzeug CVE-2024-34069 🚨 HIGH 2.2.3 3.0.3
aiohttp CVE-2025-69223 🚨 HIGH 3.12.12 3.13.3
aiohttp CVE-2025-69223 🚨 HIGH 3.13.2 3.13.3
apache-airflow CVE-2025-68438 🚨 HIGH 3.1.5 3.1.6
apache-airflow CVE-2025-68675 🚨 HIGH 3.1.5 3.1.6, 2.11.1
apache-airflow-providers-http CVE-2025-69219 🚨 HIGH 5.6.0 6.0.0
azure-core CVE-2026-21226 🚨 HIGH 1.37.0 1.38.0
cryptography CVE-2026-26007 🚨 HIGH 42.0.8 46.0.5
google-cloud-aiplatform CVE-2026-2472 🚨 HIGH 1.130.0 1.131.0
google-cloud-aiplatform CVE-2026-2473 🚨 HIGH 1.130.0 1.133.0
jaraco.context CVE-2026-23949 🚨 HIGH 5.3.0 6.1.0
jaraco.context CVE-2026-23949 🚨 HIGH 6.0.1 6.1.0
protobuf CVE-2026-0994 🚨 HIGH 4.25.8 6.33.5, 5.29.6
pyOpenSSL CVE-2026-27459 🚨 HIGH 24.1.0 26.0.0
pyasn1 CVE-2026-23490 🚨 HIGH 0.6.1 0.6.2
python-multipart CVE-2026-24486 🚨 HIGH 0.0.20 0.0.22
ray CVE-2025-62593 🔥 CRITICAL 2.47.1 2.52.0
starlette CVE-2025-62727 🚨 HIGH 0.48.0 0.49.1
tornado CVE-2026-31958 🚨 HIGH 6.5.3 6.5.5
urllib3 CVE-2025-66418 🚨 HIGH 1.26.20 2.6.0
urllib3 CVE-2025-66471 🚨 HIGH 1.26.20 2.6.0
urllib3 CVE-2026-21441 🚨 HIGH 1.26.20 2.6.3
wheel CVE-2026-24049 🚨 HIGH 0.45.1 0.46.2
wheel CVE-2026-24049 🚨 HIGH 0.45.1 0.46.2

🛡️ TRIVY SCAN RESULT 🛡️

Target: usr/bin/docker

Vulnerabilities (3)

Package Vulnerability ID Severity Installed Version Fixed Version
stdlib CVE-2025-68121 🔥 CRITICAL v1.25.5 1.24.13, 1.25.7, 1.26.0-rc.3
stdlib CVE-2025-61726 🚨 HIGH v1.25.5 1.24.12, 1.25.6
stdlib CVE-2025-61728 🚨 HIGH v1.25.5 1.24.12, 1.25.6

🛡️ TRIVY SCAN RESULT 🛡️

Target: /etc/ssl/private/ssl-cert-snakeoil.key

No Vulnerabilities Found

🛡️ TRIVY SCAN RESULT 🛡️

Target: /home/airflow/openmetadata-airflow-apis/openmetadata_managed_apis.egg-info/PKG-INFO

No Vulnerabilities Found

@github-actions

Copy link
Copy Markdown
Contributor

The Python checkstyle failed.

Please run make py_format and py_format_check in the root of your repository and commit the changes to this PR.
You can also use pre-commit to automate the Python code formatting.

You can install the pre-commit hooks with make install_test precommit_install.

harshach and others added 4 commits March 17, 2026 10:36
1. Add authorization check on getTermRelationGraph endpoint
2. Add null guard on getBaseUri() to prevent NPE
3. Add React key prop on RelatedTermTagButton in map renders
4. Mark RdfResource lazy-init fields as volatile for thread safety
5. Replace exception messages with generic errors in API responses
6. Unify DEFAULT_RELATION_TYPES between CSV and repository (10 types)
7. Add jitter backoff to deadlock retry in CollectionDAO
8. Replace N+1 queries in prefetchGraphTerms with batch fetch

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Remove tmpfs size limit on Fuseki container to prevent disk exhaustion
- Guard RdfUpdater.initialize() in GlossaryTermRelationIT to skip if
  already initialized by bootstrap

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
harshach and others added 2 commits March 17, 2026 15:39
…lder

- Deduplicate edges in buildGraph() using edgesSeen set
- Skip TermRelation entries with null term references to prevent NPE
- Add warning log when glossary term relation settings fail to load

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
try {
// Clear entire RDF store before re-indexing to remove stale data
LOG.info("Clearing RDF store before re-indexing");
rdfRepository.clearAll();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance: RDF clearAll() causes complete data loss window during re-index

RdfIndexApp.reIndexFromStartToEnd() calls rdfRepository.clearAll() (SPARQL CLEAR ALL) synchronously before beginning re-indexing. There is no read lock, status flag, or shadow-index pattern, so any concurrent SPARQL query (from the /v1/rdf/sparql endpoints or other consumers) will return empty results during the entire re-indexing window, which can last many minutes for large catalogs.

Consider either: (a) using a named-graph swap pattern (write to a shadow graph, then rename), (b) adding an isReindexing flag that makes query endpoints return a 503 with a clear message, or (c) performing incremental updates instead of clear-and-rebuild.

Was this helpful? React with 👍 / 👎 | Reply gitar fix to apply this suggestion

}

@Transaction
public GlossaryTerm addTermRelation(UUID id, TermRelation termRelation) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Bug: addTermRelation has TOCTOU race allowing duplicate relations

addTermRelation checks for an existing relation by streaming term.getRelatedTerms() (a read from the DB), then inserts the relation via addRelationship — but these two operations are not atomic. Two concurrent requests for the same term pair and relation type can both pass the existence check and both insert, creating a duplicate edge. The same race applies to validateRelationCardinality: concurrent requests can each read the same count and both pass the limit.

Fix: Use a database-level unique constraint on (fromId, toId, relationship, json->relationType), or serialize the check+insert with a lock per term ID.

Was this helpful? React with 👍 / 👎 | Reply gitar fix to apply this suggestion

harshach and others added 2 commits March 17, 2026 20:39
- getRelationCount now matches inverse relation type for fromRecords
  where the term is the target, fixing cardinality bypass after
  bidirectional UUID canonicalization
- Use double-checked locking in RdfResource.getSemanticSearchEngine()
  to prevent duplicate instance creation under concurrency

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@gitar-bot

gitar-bot Bot commented Mar 18, 2026

Copy link
Copy Markdown
Code Review ⚠️ Changes requested 13 resolved / 15 findings

Glossary relations implementation adds term relationship management with cardinality validation and RDF support, but three important issues remain: cardinality validation counts wrong relation types after canonical swap, RDF clearAll() causes complete data loss during re-indexing, and addTermRelation has a TOCTOU race condition allowing duplicate relations.

⚠️ Performance: RDF clearAll() causes complete data loss window during re-index

📄 openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/rdf/RdfIndexApp.java:271

RdfIndexApp.reIndexFromStartToEnd() calls rdfRepository.clearAll() (SPARQL CLEAR ALL) synchronously before beginning re-indexing. There is no read lock, status flag, or shadow-index pattern, so any concurrent SPARQL query (from the /v1/rdf/sparql endpoints or other consumers) will return empty results during the entire re-indexing window, which can last many minutes for large catalogs.

Consider either: (a) using a named-graph swap pattern (write to a shadow graph, then rename), (b) adding an isReindexing flag that makes query endpoints return a 503 with a clear message, or (c) performing incremental updates instead of clear-and-rebuild.

⚠️ Bug: addTermRelation has TOCTOU race allowing duplicate relations

📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/GlossaryTermRepository.java:641

addTermRelation checks for an existing relation by streaming term.getRelatedTerms() (a read from the DB), then inserts the relation via addRelationship — but these two operations are not atomic. Two concurrent requests for the same term pair and relation type can both pass the existence check and both insert, creating a duplicate edge. The same race applies to validateRelationCardinality: concurrent requests can each read the same count and both pass the limit.

Fix: Use a database-level unique constraint on (fromId, toId, relationship, json->relationType), or serialize the check+insert with a lock per term ID.

✅ 13 resolved
✅ Bug: Cardinality validation miscounts asymmetric relations

📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/GlossaryTermRepository.java:686 📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/GlossaryTermRepository.java:700
The getRelationCount method queries both findTo and findFrom records and reads the stored relationType from JSON directly. Since addRelationship with bidirectional=true canonicalizes UUID ordering, the stored JSON always has the original relation type (e.g., "broader") regardless of which term is the canonical fromId. When counting from the non-canonical term's perspective, the method counts the raw stored type without inverting it. For asymmetric relations like broader/narrower, this means:

  1. From term B's perspective, findFrom(B) returns a record with relationType=broader when it should logically be narrower
  2. Cardinality checks for narrower on term B will undercount (missing the actual relation)
  3. Cardinality checks for broader on term B will overcount

This corrupts cardinality enforcement for all asymmetric relation types (broader/narrower, partOf/hasPart, calculatedFrom/usedToCalculate).

✅ Security: Exception message leaked to API response in error JSON

📄 openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfRepository.java:1304 📄 openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfRepository.java:818 📄 openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfRepository.java:822 📄 openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfRepository.java:1034 📄 openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/rdf/RdfIndexApp.java:483 📄 openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/rdf/RdfIndexApp.java:497 📄 openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfRepository.java:1232 📄 openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfRepository.java:819 📄 openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfRepository.java:823 📄 openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfRepository.java:1342 📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/rdf/RdfResource.java:507 📄 openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfRepository.java:909 📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/rdf/RdfResource.java:509
In getGlossaryTermGraphFromDatabase, when an exception occurs, e.getMessage() is placed directly into the JSON response returned to the client. Exception messages from database drivers, serialization libraries, or other internal components can contain sensitive information (e.g., SQL fragments, internal class names, stack details).

While this endpoint requires authentication, exposing raw exception messages to API consumers is a security anti-pattern. The error is already properly logged at ERROR level for debugging.

Consider returning a generic error message instead:

graphData.put("error", "Failed to load graph data from database");
✅ Bug: Inconsistent DEFAULT_RELATION_TYPES between CSV and repository

📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/GlossaryRepository.java:371 📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/GlossaryTermRepository.java:616 📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/GlossaryTermRepository.java:737 📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/system/SystemResource.java:896 📄 openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfRepository.java:933 📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/GlossaryTermRepository.java:602 📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/rdf/RdfResource.java:498
GlossaryRepository.GlossaryCsv.DEFAULT_RELATION_TYPES contains 10 types (including calculatedFrom, usedToCalculate, seeAlso) while GlossaryTermRepository.DEFAULT_RELATION_TYPES only has 7. When the settings cache is unavailable (e.g., during bootstrap or cache failure), the CSV import parser accepts relation types like calculatedFrom:Glossary.Term but GlossaryTermRepository.validateRelationType() rejects them, causing confusing errors.

Both lists should be identical or extracted to a shared constant. Consider defining the defaults in a single shared location, for example:

// In a shared constants class or on the JSON schema
public static final List<String> DEFAULT_RELATION_TYPES = List.of(
    "relatedTo", "synonym", "broader", "narrower", "antonym",
    "partOf", "hasPart", "calculatedFrom", "usedToCalculate", "seeAlso");
✅ Security: Missing authorization check on getTermRelationGraph endpoint

📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryTermResource.java:1209 📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryTermResource.java:1186 📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryTermResource.java:1120 📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/GlossaryTermRepository.java:602
The getTermRelationGraph endpoint at GET /{id}/relationsGraph (line 1209) does not perform any authorization check before calling repository.getTermRelationGraph(). Every other new endpoint in this PR (e.g., getRelationTypeUsageCounts at line 436, getAllGlossaryTermsWithAssetsCount at line 458, addTermRelation at line 1136, removeTermRelation at line 1169) includes proper authorization via authorizer.authorize(securityContext, operationContext, ...).

This means any authenticated user can retrieve the full relation graph for any glossary term regardless of their permissions, potentially leaking term names and relationships the user shouldn't have access to.

✅ Bug: getBaseUri() NPE when RDF enabled without baseUri config

📄 openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfRepository.java:96 📄 openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfRepository.java:92
The new getBaseUri() method at line 96 calls config.getBaseUri().toString() without a null check. The isEnabled() check only verifies config.getEnabled() and storageService != null, not that baseUri is set. If RDF is enabled but baseUri is null (misconfiguration), this will throw an NPE. The method is called from RdfTagUpdater which guards with isEnabled(), but also from parseGlossaryTermGraphResults (line 1057) and exportGlossaryAsOntology.

...and 8 more resolved from earlier reviews

🤖 Prompt for agents
Code Review: Glossary relations implementation adds term relationship management with cardinality validation and RDF support, but three important issues remain: cardinality validation counts wrong relation types after canonical swap, RDF clearAll() causes complete data loss during re-indexing, and addTermRelation has a TOCTOU race condition allowing duplicate relations.

1. ⚠️ Performance: RDF clearAll() causes complete data loss window during re-index
   Files: openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/rdf/RdfIndexApp.java:271

   `RdfIndexApp.reIndexFromStartToEnd()` calls `rdfRepository.clearAll()` (SPARQL `CLEAR ALL`) synchronously before beginning re-indexing. There is no read lock, status flag, or shadow-index pattern, so any concurrent SPARQL query (from the `/v1/rdf/sparql` endpoints or other consumers) will return empty results during the entire re-indexing window, which can last many minutes for large catalogs.
   
   Consider either: (a) using a named-graph swap pattern (write to a shadow graph, then rename), (b) adding an `isReindexing` flag that makes query endpoints return a 503 with a clear message, or (c) performing incremental updates instead of clear-and-rebuild.

2. ⚠️ Bug: addTermRelation has TOCTOU race allowing duplicate relations
   Files: openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/GlossaryTermRepository.java:641

   `addTermRelation` checks for an existing relation by streaming `term.getRelatedTerms()` (a read from the DB), then inserts the relation via `addRelationship` — but these two operations are not atomic. Two concurrent requests for the same term pair and relation type can both pass the existence check and both insert, creating a duplicate edge. The same race applies to `validateRelationCardinality`: concurrent requests can each read the same count and both pass the limit.
   
   Fix: Use a database-level unique constraint on (fromId, toId, relationship, json->relationType), or serialize the check+insert with a lock per term ID.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

This branch was previously deployed

1 inactive deployment
test — b1034be0 Deployed Mar 18, 2026 by harshach via playwright-ci-postgresql (2, 6) #37820
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants