Skip to content

Commit e9cadf2

Browse files
authored
Add {m365_defender,microsoft_defender_endpoint}.vulnerability indices to kibana_system role permissions (#132445) (#132628)
Add logs-m365_defender.vulnerability-* and logs-microsoft_defender_endpoint.vulnerability-* data stream indices to the kibana_system's read privileges. This is required for the latest transform for 3rd party integrations CDR workflows (vulnerability findings) to work. Also add delete_index on logs-m365_defender.vulnerability-* and logs-microsoft_defender_endpoint.vulnerability-* to facilitate index removal through ILM policies. (cherry picked from commit 716bff8)
1 parent 15cd4aa commit e9cadf2

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,17 @@ static RoleDescriptor kibanaSystem(String name) {
481481
)
482482
.privileges("read", "view_index_metadata")
483483
.build(),
484+
// For source indices of the Cloud Detection & Response (CDR) packages
485+
// that ships a transform and has ILM policy
486+
RoleDescriptor.IndicesPrivileges.builder()
487+
.indices("logs-m365_defender.vulnerability-*", "logs-microsoft_defender_endpoint.vulnerability-*")
488+
.privileges(
489+
"read",
490+
"view_index_metadata",
491+
// Require "delete_index" to perform ILM policy actions
492+
TransportDeleteIndexAction.TYPE.name()
493+
)
494+
.build(),
484495
// For ExtraHop and QualysGAV specific actions. Kibana reads, writes and manages this index
485496
// for configured ILM policies.
486497
RoleDescriptor.IndicesPrivileges.builder()

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,6 +1677,40 @@ public void testKibanaSystemRole() {
16771677
);
16781678
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportPutMappingAction.TYPE.name()).test(indexAbstraction), is(true));
16791679
assertThat(kibanaRole.indices().allowedIndicesMatcher(RolloverAction.NAME).test(indexAbstraction), is(true));
1680+
// Implied by the overall view_index_metadata and monitor privilege
1681+
assertViewIndexMetadata(kibanaRole, indexName);
1682+
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:monitor/").test(indexAbstraction), is(true));
1683+
});
1684+
1685+
Arrays.asList(
1686+
"logs-m365_defender.vulnerability-" + randomAlphaOfLength(randomIntBetween(0, 13)),
1687+
"logs-microsoft_defender_endpoint.vulnerability-" + randomAlphaOfLength(randomIntBetween(0, 13))
1688+
).forEach(indexName -> {
1689+
final IndexAbstraction indexAbstraction = mockIndexAbstraction(indexName);
1690+
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:foo").test(indexAbstraction), is(false));
1691+
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:bar").test(indexAbstraction), is(false));
1692+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportDeleteIndexAction.TYPE.name()).test(indexAbstraction), is(true));
1693+
assertThat(kibanaRole.indices().allowedIndicesMatcher(GetIndexAction.NAME).test(indexAbstraction), is(true));
1694+
assertThat(
1695+
kibanaRole.indices().allowedIndicesMatcher(TransportCreateIndexAction.TYPE.name()).test(indexAbstraction),
1696+
is(false)
1697+
);
1698+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportIndexAction.NAME).test(indexAbstraction), is(false));
1699+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportDeleteAction.NAME).test(indexAbstraction), is(false));
1700+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportSearchAction.TYPE.name()).test(indexAbstraction), is(true));
1701+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportMultiSearchAction.TYPE.name()).test(indexAbstraction), is(true));
1702+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportGetAction.TYPE.name()).test(indexAbstraction), is(true));
1703+
assertThat(kibanaRole.indices().allowedIndicesMatcher(READ_CROSS_CLUSTER_NAME).test(indexAbstraction), is(false));
1704+
assertThat(
1705+
kibanaRole.indices().allowedIndicesMatcher(TransportUpdateSettingsAction.TYPE.name()).test(indexAbstraction),
1706+
is(true)
1707+
);
1708+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportPutMappingAction.TYPE.name()).test(indexAbstraction), is(true));
1709+
assertThat(kibanaRole.indices().allowedIndicesMatcher(RolloverAction.NAME).test(indexAbstraction), is(true));
1710+
// Implied by the overall view_index_metadata and monitor privilege
1711+
assertViewIndexMetadata(kibanaRole, indexName);
1712+
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:monitor/").test(indexAbstraction), is(true));
1713+
16801714
});
16811715

16821716
Arrays.asList(

0 commit comments

Comments
 (0)