Skip to content

Commit 5e65044

Browse files
committed
changed privileges
1 parent 2b0f455 commit 5e65044

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/store/KibanaOwnedReservedRoleDescriptors.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ static RoleDescriptor kibanaSystem(String name) {
177177
// Knowledge base. Fleet creates, manages, and uses this index to store knowledge base documents to be consumed by AI assistants.
178178
RoleDescriptor.IndicesPrivileges.builder()
179179
.indices(".integration_knowledge*")
180-
.privileges("all")
180+
.privileges("read", "write", "create_index")
181181
.build(),
182182
// Other Fleet indices. Kibana reads and writes to these indices to manage
183183
// Elastic Agents.

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/store/ReservedRolesStoreTests.java

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -937,9 +937,29 @@ public void testKibanaSystemRole() {
937937
).forEach(index -> assertAllIndicesAccessAllowed(kibanaRole, index));
938938

939939
// Knowledge base. Fleet creates, manages, and uses this index to store knowledge base documents to be consumed by AI assistants.
940-
Arrays.asList(".integration_knowledge" + randomAlphaOfLength(randomIntBetween(0, 13))).forEach(
941-
index -> assertAllIndicesAccessAllowed(kibanaRole, index)
942-
);
940+
Arrays.asList(".integration_knowledge" + randomAlphaOfLength(randomIntBetween(0, 13))).forEach((index) -> {
941+
final IndexAbstraction indexAbstraction = mockIndexAbstraction(index);
942+
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:foo").test(indexAbstraction), is(false));
943+
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:bar").test(indexAbstraction), is(false));
944+
assertThat(
945+
kibanaRole.indices().allowedIndicesMatcher(TransportDeleteIndexAction.TYPE.name()).test(indexAbstraction),
946+
is(false)
947+
);
948+
assertThat(kibanaRole.indices().allowedIndicesMatcher(GetIndexAction.NAME).test(indexAbstraction), is(true));
949+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportCreateIndexAction.TYPE.name()).test(indexAbstraction), is(true));
950+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportIndexAction.NAME).test(indexAbstraction), is(true));
951+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportDeleteAction.NAME).test(indexAbstraction), is(true));
952+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportSearchAction.TYPE.name()).test(indexAbstraction), is(true));
953+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportMultiSearchAction.TYPE.name()).test(indexAbstraction), is(true));
954+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportGetAction.TYPE.name()).test(indexAbstraction), is(true));
955+
assertThat(kibanaRole.indices().allowedIndicesMatcher(READ_CROSS_CLUSTER_NAME).test(indexAbstraction), is(false));
956+
assertThat(
957+
kibanaRole.indices().allowedIndicesMatcher(TransportUpdateSettingsAction.TYPE.name()).test(indexAbstraction),
958+
is(false)
959+
);
960+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportPutMappingAction.TYPE.name()).test(indexAbstraction), is(false));
961+
assertThat(kibanaRole.indices().allowedIndicesMatcher(RolloverAction.NAME).test(indexAbstraction), is(false));
962+
});
943963

944964
final IndexAbstraction dotFleetSecretsIndex = mockIndexAbstraction(".fleet-secrets");
945965
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:foo").test(dotFleetSecretsIndex), is(false));

0 commit comments

Comments
 (0)