mchades commented on code in PR #14907:
URL: https://github.com/apache/gravitino/pull/14907#discussion_r4539743818


##########
server-common/src/main/java/org/apache/gravitino/server/authorization/DomainAuthzHelper.java:
##########
@@ -323,15 +323,16 @@ public static DomainMember[] listMembers(
     if (!filter.domains().isEmpty()) {
       Set<String> selected = new HashSet<>(filter.domains());
       selected.retainAll(visibleNames);
-      if (selected.isEmpty()) {
-        return new DomainMember[0];
+      // Preserve an unmatched nonempty filter so the dispatcher still emits 
query events.
+      // Replacing it with an empty filter would incorrectly select the whole 
scope.
+      if (!selected.isEmpty()) {
+        effectiveFilter =
+            DomainMemberFilter.builder()
+                .withDomains(selected.toArray(new String[0]))
+                .withTypes(filter.types().toArray(new MetadataObject.Type[0]))
+                .withNameContains(filter.nameContains().orElse(null))
+                .build();
       }
-      effectiveFilter =
-          DomainMemberFilter.builder()
-              .withDomains(selected.toArray(new String[0]))
-              .withTypes(filter.types().toArray(new MetadataObject.Type[0]))
-              .withNameContains(filter.nameContains().orElse(null))
-              .build();
     }
     DomainMember[] members = dispatcher.listMembers(metalake, domain, 
subdomains, effectiveFilter);

Review Comment:
   With authorization enabled, `GET 
/api/metalakes/lake/domains/missing/objects` returns 404 and emits only 
`GET_DOMAIN/FAILURE`. The `getDomain` lookup above sets the failure flag before 
this call, so `HttpAuditFilter` also skips the entry with the `/objects` URI. 
With authorization disabled, the same request emits 
`LIST_DOMAIN_MEMBERS/FAILURE`. Please use `internalDomainDispatcher()` for the 
domain and child snapshot reads, keep this `listMembers` call on the event 
dispatcher, and cover the 404 on this endpoint.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to