Skip to content

Commit 4d301c9

Browse files
committed
Cleaner selector handling
1 parent bf3d46b commit 4d301c9

File tree

1 file changed

+3
-3
lines changed
  • x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/privilege

1 file changed

+3
-3
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/privilege/IndexPrivilege.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.elasticsearch.action.datastreams.PromoteDataStreamAction;
3232
import org.elasticsearch.action.fieldcaps.TransportFieldCapabilitiesAction;
3333
import org.elasticsearch.action.search.TransportSearchShardsAction;
34+
import org.elasticsearch.action.support.IndexComponentSelector;
3435
import org.elasticsearch.cluster.metadata.DataStream;
3536
import org.elasticsearch.common.Strings;
3637
import org.elasticsearch.core.Nullable;
@@ -371,10 +372,9 @@ public static Set<String> names() {
371372
public static Collection<String> findPrivilegesThatGrant(String action) {
372373
return VALUES.entrySet()
373374
.stream()
375+
// Only include privileges that grant data access; failures access is handled separately in authorization failure messages
376+
.filter(e -> e.getValue().selectorPrivilege.grants(IndexComponentSelector.DATA))
374377
.filter(e -> e.getValue().predicate.test(action))
375-
// Filter out the failure store privileges since these are confusing w.r.t. authorization failure messages are a handled
376-
// separately
377-
.filter(e -> false == (e.getValue().getSelectorPrivilege() == IndexComponentSelectorPrivilege.FAILURES))
378378
.map(Map.Entry::getKey)
379379
.toList();
380380
}

0 commit comments

Comments
 (0)