-
Notifications
You must be signed in to change notification settings - Fork 686
[#9238] fix(authz): fix list tags for columns error #9257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a bug where listing tags on columns failed due to missing authorization handling for the COLUMN entity type. The fix adds proper hierarchy extraction for column identifiers, ensuring that authorization checks can properly validate access through the column's parent entities (table, schema, catalog).
Key Changes
- Added COLUMN case handling in
MetadataAuthzHelper.spiltMetadataNames()to extract parent entity identifiers - Implemented
getTableIdentifier()utility method to extract table identifiers from column identifiers - Added integration test
testListColumnTag()to verify column tag listing works correctly
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| server-common/src/main/java/org/apache/gravitino/server/authorization/MetadataAuthzHelper.java | Added COLUMN case to extract parent entity hierarchy (table, schema, catalog) for authorization checks |
| core/src/main/java/org/apache/gravitino/utils/NameIdentifierUtil.java | Implemented getTableIdentifier() method to extract table identifier from column identifiers |
| clients/client-java/src/test/java/org/apache/gravitino/client/integration/test/authorization/TagOperationsAuthorizationIT.java | Added integration test to verify column tag listing with authorization enabled |
core/src/main/java/org/apache/gravitino/utils/NameIdentifierUtil.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/gravitino/utils/NameIdentifierUtil.java
Outdated
Show resolved
Hide resolved
|
Could you correct your description? |
…il.java Co-authored-by: Copilot <[email protected]>
…il.java Co-authored-by: Copilot <[email protected]>
| String metalake, Entity.EntityType entityType, NameIdentifier nameIdentifier) { | ||
| Map<Entity.EntityType, NameIdentifier> nameIdentifierMap = new HashMap<>(); | ||
| nameIdentifierMap.put(Entity.EntityType.METALAKE, NameIdentifierUtil.ofMetalake(metalake)); | ||
| switch (entityType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added the two methods
parentEntityType
and
parentNameIdentifier
You can use these methods to refactor the logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
|
Wait for CI. LGTM. |
|
Could u correct the description? |
fixed |
What changes were proposed in this pull request?
fix list tags for columns error
Why are the changes needed?
Fix: #9238
Does this PR introduce any user-facing change?
None
How was this patch tested?
org.apache.gravitino.client.integration.test.authorization.TagOperationsAuthorizationIT#testListColumnTag