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


##########
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:
   Fixed in 64cdf7dca2. Domain and child snapshot reads for authorization now 
use `internalDomainDispatcher()`, while the actual `listMembers` call remains 
on the event dispatcher. Added an endpoint regression test with authorization 
enabled that asserts a missing domain returns 404 and emits an HTTP failure 
audit entry containing GET, the `/objects` request URI, and status 404. Updated 
the existing member-query tests to verify that snapshot reads no longer emit 
extra events and member-query events are preserved. All 220 related core, 
server-common, and server tests pass.



-- 
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