[MINOR] fix(auth): Handle missing parent catalog during metadata id resolution - #12214
Open
jarredhj0214 wants to merge 2 commits into
Open
[MINOR] fix(auth): Handle missing parent catalog during metadata id resolution#12214jarredhj0214 wants to merge 2 commits into
jarredhj0214 wants to merge 2 commits into
Conversation
Contributor
|
Could u create an issue first? The fix type pull request should have an issue to track the fixed version. |
Contributor
Author
ok |
Code Coverage Report
Files
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This PR updates
MetadataIdConverterto gracefully handle missing parent metadata during metadata id resolution.When resolving metadata ids for objects such as filesets, schemas, tables, or topics,
MetadataIdConverternormalizes the object identifier according to the parent catalog's case-sensitivity capability before looking up the entity id. If that parent catalog no longer exists, the target metadata cannot be resolved, so the converter now returnsOptional.empty()instead of propagatingNotFoundException.A unit test was added to cover the missing parent catalog case.
Why are the changes needed?
Revoking privileges from a role for a metadata object whose parent catalog no longer exists can fail during authorization expression evaluation with an internal error.
For example, the failure can look like:
This happens before the revoke operation reaches the business logic. During authorization, the requested metadata object is converted to an internal metadata id. For child metadata objects, this conversion first loads the parent catalog to apply the correct case-sensitivity normalization. If the parent catalog has already been dropped, that lookup throws
NoSuchCatalogException, which currently bubbles up through the authorization expression evaluator as an internal error.Returning
Optional.empty()is consistent with the existing contract ofMetadataIdConverter#getID: if the metadata object cannot be resolved, the converter should return empty. A missing parent catalog means the requested child metadata object cannot exist or be resolved in Gravitino, so treating it as missing metadata is safer and more accurate than failing authorization evaluation with an internal exception.Fix: #12216
Does this PR introduce any user-facing change?
No API or configuration changes.
How was this patch tested?
Ran: