Skip to content

Commit 7800e99

Browse files
authored
add priviliges required for cdr misconfiguration features to work (elastic#112456)
1 parent 550af4f commit 7800e99

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,12 +394,14 @@ static RoleDescriptor kibanaSystem(String name) {
394394
TransportUpdateSettingsAction.TYPE.name()
395395
)
396396
.build(),
397-
// For src/dest indices of the Cloud Security Posture packages that ships a
397+
// For source indices of the Cloud Security Posture packages that ships a
398398
// transform
399399
RoleDescriptor.IndicesPrivileges.builder()
400400
.indices("logs-cloud_security_posture.findings-*", "logs-cloud_security_posture.vulnerabilities-*")
401401
.privileges("read", "view_index_metadata")
402402
.build(),
403+
// For destination indices of the Cloud Security Posture packages that ships a
404+
// transform
403405
RoleDescriptor.IndicesPrivileges.builder()
404406
.indices(
405407
"logs-cloud_security_posture.findings_latest-default*",
@@ -415,17 +417,23 @@ static RoleDescriptor kibanaSystem(String name) {
415417
TransportUpdateSettingsAction.TYPE.name()
416418
)
417419
.build(),
420+
// For source indices of the Cloud Detection & Response (CDR) packages that ships a
421+
// transform
418422
RoleDescriptor.IndicesPrivileges.builder()
419-
.indices("logs-wiz.vulnerability-*")
423+
.indices("logs-wiz.vulnerability-*", "logs-wiz.cloud_configuration_finding-*")
420424
.privileges("read", "view_index_metadata")
421425
.build(),
426+
// For alias indices of the Cloud Detection & Response (CDR) packages that ships a
427+
// transform
422428
RoleDescriptor.IndicesPrivileges.builder()
423429
// manage privilege required by the index alias
424-
.indices("security_solution-*.vulnerability_latest")
430+
.indices("security_solution-*.vulnerability_latest", "security_solution-*.misconfiguration_latest")
425431
.privileges("manage", TransportIndicesAliasesAction.NAME, TransportUpdateSettingsAction.TYPE.name())
426432
.build(),
433+
// For destination indices of the Cloud Detection & Response (CDR) packages that ships a
434+
// transform
427435
RoleDescriptor.IndicesPrivileges.builder()
428-
.indices("security_solution-*.vulnerability_latest-*")
436+
.indices("security_solution-*.vulnerability_latest-*", "security_solution-*.misconfiguration_latest-*")
429437
.privileges(
430438
"create_index",
431439
"index",

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,8 +1609,11 @@ public void testKibanaSystemRole() {
16091609
assertThat(kibanaRole.indices().allowedIndicesMatcher(RolloverAction.NAME).test(indexAbstraction), is(true));
16101610
});
16111611

1612-
Arrays.asList("logs-wiz.vulnerability-" + randomAlphaOfLength(randomIntBetween(0, 13))).forEach((cspIndex) -> {
1613-
final IndexAbstraction indexAbstraction = mockIndexAbstraction(cspIndex);
1612+
Arrays.asList(
1613+
"logs-wiz.vulnerability-" + randomAlphaOfLength(randomIntBetween(0, 13)),
1614+
"logs-wiz.cloud_configuration_finding-" + randomAlphaOfLength(randomIntBetween(0, 13))
1615+
).forEach(indexName -> {
1616+
final IndexAbstraction indexAbstraction = mockIndexAbstraction(indexName);
16141617
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:foo").test(indexAbstraction), is(false));
16151618
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:bar").test(indexAbstraction), is(false));
16161619
assertThat(
@@ -1643,7 +1646,8 @@ public void testKibanaSystemRole() {
16431646
"logs-cloud_security_posture.findings_latest-default-" + Version.CURRENT,
16441647
"logs-cloud_security_posture.scores-default-" + Version.CURRENT,
16451648
"logs-cloud_security_posture.vulnerabilities_latest-default" + Version.CURRENT,
1646-
"security_solution-*.vulnerability_latest-" + Version.CURRENT
1649+
"security_solution-*.vulnerability_latest-" + Version.CURRENT,
1650+
"security_solution-*.misconfiguration_latest-" + Version.CURRENT
16471651
).forEach(indexName -> {
16481652
logger.info("index name [{}]", indexName);
16491653
final IndexAbstraction indexAbstraction = mockIndexAbstraction(indexName);

0 commit comments

Comments
 (0)