Skip to content

Commit bac105c

Browse files
committed
Add {m365_defender,microsoft_defender_endpoint}.vulnerability indices to kibana_system role permissions (elastic#132445)
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 a598d0d commit bac105c

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
@@ -483,6 +483,17 @@ static RoleDescriptor kibanaSystem(String name) {
483483
)
484484
.privileges("read", "view_index_metadata")
485485
.build(),
486+
// For source indices of the Cloud Detection & Response (CDR) packages
487+
// that ships a transform and has ILM policy
488+
RoleDescriptor.IndicesPrivileges.builder()
489+
.indices("logs-m365_defender.vulnerability-*", "logs-microsoft_defender_endpoint.vulnerability-*")
490+
.privileges(
491+
"read",
492+
"view_index_metadata",
493+
// Require "delete_index" to perform ILM policy actions
494+
TransportDeleteIndexAction.TYPE.name()
495+
)
496+
.build(),
486497
// For ExtraHop and QualysGAV specific actions. Kibana reads, writes and manages this index
487498
// for configured ILM policies.
488499
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
@@ -1691,6 +1691,40 @@ public void testKibanaSystemRole() {
16911691
);
16921692
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportPutMappingAction.TYPE.name()).test(indexAbstraction), is(true));
16931693
assertThat(kibanaRole.indices().allowedIndicesMatcher(RolloverAction.NAME).test(indexAbstraction), is(true));
1694+
// Implied by the overall view_index_metadata and monitor privilege
1695+
assertViewIndexMetadata(kibanaRole, indexName);
1696+
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:monitor/").test(indexAbstraction), is(true));
1697+
});
1698+
1699+
Arrays.asList(
1700+
"logs-m365_defender.vulnerability-" + randomAlphaOfLength(randomIntBetween(0, 13)),
1701+
"logs-microsoft_defender_endpoint.vulnerability-" + randomAlphaOfLength(randomIntBetween(0, 13))
1702+
).forEach(indexName -> {
1703+
final IndexAbstraction indexAbstraction = mockIndexAbstraction(indexName);
1704+
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:foo").test(indexAbstraction), is(false));
1705+
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:bar").test(indexAbstraction), is(false));
1706+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportDeleteIndexAction.TYPE.name()).test(indexAbstraction), is(true));
1707+
assertThat(kibanaRole.indices().allowedIndicesMatcher(GetIndexAction.NAME).test(indexAbstraction), is(true));
1708+
assertThat(
1709+
kibanaRole.indices().allowedIndicesMatcher(TransportCreateIndexAction.TYPE.name()).test(indexAbstraction),
1710+
is(false)
1711+
);
1712+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportIndexAction.NAME).test(indexAbstraction), is(false));
1713+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportDeleteAction.NAME).test(indexAbstraction), is(false));
1714+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportSearchAction.TYPE.name()).test(indexAbstraction), is(true));
1715+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportMultiSearchAction.TYPE.name()).test(indexAbstraction), is(true));
1716+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportGetAction.TYPE.name()).test(indexAbstraction), is(true));
1717+
assertThat(kibanaRole.indices().allowedIndicesMatcher(READ_CROSS_CLUSTER_NAME).test(indexAbstraction), is(false));
1718+
assertThat(
1719+
kibanaRole.indices().allowedIndicesMatcher(TransportUpdateSettingsAction.TYPE.name()).test(indexAbstraction),
1720+
is(true)
1721+
);
1722+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportPutMappingAction.TYPE.name()).test(indexAbstraction), is(true));
1723+
assertThat(kibanaRole.indices().allowedIndicesMatcher(RolloverAction.NAME).test(indexAbstraction), is(true));
1724+
// Implied by the overall view_index_metadata and monitor privilege
1725+
assertViewIndexMetadata(kibanaRole, indexName);
1726+
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:monitor/").test(indexAbstraction), is(true));
1727+
16941728
});
16951729

16961730
Arrays.asList(

0 commit comments

Comments
 (0)