Skip to content

Commit 35e366a

Browse files
committed
Add permissions for Microsoft Defender integrations required for 3rd party vulnerability findings workflow.
1 parent 364c70e commit 35e366a

File tree

2 files changed

+41
-6
lines changed

2 files changed

+41
-6
lines changed

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,10 +517,24 @@ static RoleDescriptor kibanaSystem(String name) {
517517
"logs-tenable_io.vulnerability-*",
518518
"logs-rapid7_insightvm.vulnerability-*",
519519
"logs-rapid7_insightvm.asset_vulnerability-*",
520-
"logs-carbon_black_cloud.asset_vulnerability_summary-*"
520+
"logs-carbon_black_cloud.asset_vulnerability_summary-*",
521+
"logs-m365_defender.vulnerability-*",
522+
"logs-microsoft_defender_endpoint.vulnerability-*"
521523
)
522524
.privileges("read", "view_index_metadata")
523525
.build(),
526+
// For source indices of the Cloud Detection & Response (CDR) packages
527+
// that has ILM policy
528+
RoleDescriptor.IndicesPrivileges.builder()
529+
.indices(
530+
"logs-m365_defender.vulnerability-*",
531+
"logs-microsoft_defender_endpoint.vulnerability-*"
532+
)
533+
.privileges(
534+
// Require "delete_index" to perform ILM policy actions
535+
TransportDeleteIndexAction.TYPE.name()
536+
)
537+
.build(),
524538
// For alias indices of the Cloud Detection & Response (CDR) packages that ships a
525539
// transform
526540
RoleDescriptor.IndicesPrivileges.builder()

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

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,15 +1687,22 @@ public void testKibanaSystemRole() {
16871687
"logs-tenable_io.vulnerability-" + randomAlphaOfLength(randomIntBetween(0, 13)),
16881688
"logs-rapid7_insightvm.vulnerability-" + randomAlphaOfLength(randomIntBetween(0, 13)),
16891689
"logs-rapid7_insightvm.asset_vulnerability-" + randomAlphaOfLength(randomIntBetween(0, 13)),
1690-
"logs-carbon_black_cloud.asset_vulnerability_summary-" + randomAlphaOfLength(randomIntBetween(0, 13))
1690+
"logs-carbon_black_cloud.asset_vulnerability_summary-" + randomAlphaOfLength(randomIntBetween(0, 13)),
1691+
"logs-m365_defender.vulnerability-" + randomAlphaOfLength(randomIntBetween(0, 13)),
1692+
"logs-microsoft_defender_endpoint.vulnerability-" + randomAlphaOfLength(randomIntBetween(0, 13))
16911693
).forEach(indexName -> {
16921694
final IndexAbstraction indexAbstraction = mockIndexAbstraction(indexName);
16931695
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:foo").test(indexAbstraction), is(false));
16941696
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:bar").test(indexAbstraction), is(false));
1695-
assertThat(
1696-
kibanaRole.indices().allowedIndicesMatcher(TransportDeleteIndexAction.TYPE.name()).test(indexAbstraction),
1697-
is(false)
1698-
);
1697+
if (indexAbstraction.getName().startsWith("logs-m365_defender.vulnerability-") == false &&
1698+
indexAbstraction.getName().startsWith("logs-microsoft_defender_endpoint.vulnerability-") == false) {
1699+
// delete_index is granted for m365_defender.vulnerability and microsoft_defender_endpoint.vulnerability
1700+
// because of ILM policy. So exclude both from this check.
1701+
assertThat(
1702+
kibanaRole.indices().allowedIndicesMatcher(TransportDeleteIndexAction.TYPE.name()).test(indexAbstraction),
1703+
is(false)
1704+
);
1705+
}
16991706
assertThat(kibanaRole.indices().allowedIndicesMatcher(GetIndexAction.NAME).test(indexAbstraction), is(true));
17001707
assertThat(
17011708
kibanaRole.indices().allowedIndicesMatcher(TransportCreateIndexAction.TYPE.name()).test(indexAbstraction),
@@ -1715,6 +1722,20 @@ public void testKibanaSystemRole() {
17151722
assertThat(kibanaRole.indices().allowedIndicesMatcher(RolloverAction.NAME).test(indexAbstraction), is(true));
17161723
});
17171724

1725+
Arrays.asList(
1726+
"logs-m365_defender.vulnerability-" + randomAlphaOfLength(randomIntBetween(0, 13)),
1727+
"logs-microsoft_defender_endpoint.vulnerability-" + randomAlphaOfLength(randomIntBetween(0, 13))
1728+
).forEach(indexName -> {
1729+
logger.info("index name [{}]", indexName);
1730+
final IndexAbstraction indexAbstraction = mockIndexAbstraction(indexName);
1731+
// Allow delete index
1732+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportDeleteIndexAction.TYPE.name()).test(indexAbstraction), is(true));
1733+
// Implied by the overall view_index_metadata and monitor privilege
1734+
assertViewIndexMetadata(kibanaRole, indexName);
1735+
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:monitor/").test(indexAbstraction), is(true));
1736+
1737+
});
1738+
17181739
Arrays.asList(
17191740
"logs-cloud_security_posture.findings_latest-default",
17201741
"logs-cloud_security_posture.scores-default",

0 commit comments

Comments
 (0)