Skip to content

Commit 37dd755

Browse files
committed
Fix assertion
1 parent 7e1e2c0 commit 37dd755

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/role/RoleDescriptorRequestValidator.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import org.elasticsearch.xpack.core.security.authz.RoleDescriptor;
1212
import org.elasticsearch.xpack.core.security.authz.privilege.ApplicationPrivilege;
1313
import org.elasticsearch.xpack.core.security.authz.privilege.ClusterPrivilegeResolver;
14+
import org.elasticsearch.xpack.core.security.authz.privilege.IndexComponentSelectorPrivilege;
1415
import org.elasticsearch.xpack.core.security.authz.privilege.IndexPrivilege;
1516
import org.elasticsearch.xpack.core.security.authz.restriction.WorkflowResolver;
1617
import org.elasticsearch.xpack.core.security.support.MetadataUtils;
@@ -60,7 +61,13 @@ public static ActionRequestValidationException validate(
6061
validationException = addValidationError("remote index cluster alias cannot be an empty string", validationException);
6162
}
6263
try {
63-
IndexPrivilege.getSplitBySelector(Set.of(ridp.indicesPrivileges().getPrivileges()));
64+
var privileges = IndexPrivilege.getSplitBySelector(Set.of(ridp.indicesPrivileges().getPrivileges()));
65+
if (privileges.stream().anyMatch(p -> p.getSelectorPrivilege() == IndexComponentSelectorPrivilege.FAILURES)) {
66+
validationException = addValidationError(
67+
"remote index privileges cannot contain privileges that grant access to the failure store",
68+
validationException
69+
);
70+
}
6471
} catch (IllegalArgumentException ile) {
6572
validationException = addValidationError(ile.getMessage(), validationException);
6673
}

x-pack/plugin/security/qa/multi-cluster/src/javaRestTest/java/org/elasticsearch/xpack/remotecluster/RemoteClusterSecurityFcActionAuthorizationIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ public void testUpdateCrossClusterApiKey() throws Exception {
435435
+ "for user [foo] with assigned roles [role] authenticated by API key id ["
436436
+ apiKeyId
437437
+ "] of user [test_user] on indices [index], this action is granted by the index privileges "
438-
+ "[view_index_metadata,manage,read,all]"
438+
+ "[read,view_index_metadata,manage,all]"
439439
)
440440
);
441441

@@ -483,7 +483,7 @@ public void testUpdateCrossClusterApiKey() throws Exception {
483483
+ "for user [foo] with assigned roles [role] authenticated by API key id ["
484484
+ apiKeyId
485485
+ "] of user [test_user] on indices [index], this action is granted by the index privileges "
486-
+ "[view_index_metadata,manage,read,all]"
486+
+ "[read,view_index_metadata,manage,all]"
487487
)
488488
);
489489
}

0 commit comments

Comments
 (0)