Repository navigation
fix: add getParentEntity to QueryRepository for isOwner() policy evaluation - #31992
zhang-arvin wants to merge 3 commits into
Conversation
❌ PR checklist incompleteThis 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 |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
| @Override | ||
| public EntityInterface getParentEntity(Query entity, String fields) { | ||
| if (entity.getService() == null) { | ||
| return null; | ||
| } | ||
| return Entity.getEntity(entity.getService(), fields, Include.ALL); | ||
| } |
There was a problem hiding this comment.
Parent lookup lacks regression coverage
This override changes Query parent resolution for ownership-policy evaluation, but the PR adds no test covering the null-service and resolved-service paths. Without focused coverage, the ownership-policy regression fixed here can return unnoticed.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
All failing checks are the fork-typical ones ( |
|
@zhang-arvin please add a integration test to verify this |
…-service paths Adds regression coverage requested in review for the ownership-policy parent lookup: a Query with no service must return no parent (and must not throw), and a Query with a service reference must resolve that service as its parent with Include.ALL.
|
Added the requested integration coverage in e1293fc: |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
mockStatic(Entity.class) replaces every static method, so the un-stubbed Entity.getEntityFields(entityClass) returned an empty set. EntityRepository's constructor validates the patch/put field strings against allowedFields, so 'new QueryRepository()' threw IllegalArgumentException: Invalid field name queryUsedIn and both QueryRepositoryParentEntityTest cases errored before exercising getParentEntity. Stub getEntityFields() with the fields the Query repository declares (users, query, queryUsedIn, processedLineage).
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
Code Review ✅ Approved 1 closed / 1 findings🔴 High risk · Resolving a Query’s DatabaseService parent for isOwner() changes authorization decisions and could grant or deny access based on inherited ownership. Adds ✅ 1 closed✅ Bug:
|
| Compact |
|
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source
Add getParentEntity override to QueryRepository for isOwner() policy evaluation. Fixes #31717
Greptile Summary
This PR makes a Query’s DatabaseService available as its parent during ownership-policy evaluation.
QueryRepository.getParentEntityoverride.Include.ALL.Confidence Score: 4/5
The implementation appears safe to merge, with the non-blocking concern that the fixed ownership-policy behavior lacks regression coverage.
The new override follows established service-parent lookup behavior and its reachable failure paths are handled, but the policy change is not protected by a focused test.
Files Needing Attention: openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/QueryRepository.java
Important Files Changed
Reviews (1): Last reviewed commit: "fix: add getParentEntity method to Query..." | Re-trigger Greptile
Context used: