Skip to content

Commit

Permalink
[Cloud Security]Fix Cloud Security Package indices' deletion step err…
Browse files Browse the repository at this point in the history
…or for ilm policy (elastic#116982)

* add ilm deletion step permission for the findings index

* add back logs-endpoint index

* fix tests for reserved role

* fix linting issue
  • Loading branch information
Omolola-Akinleye authored Dec 9, 2024
1 parent ec66857 commit 2e9ff9a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ static RoleDescriptor kibanaSystem(String name) {
".logs-endpoint.diagnostic.collection-*",
"logs-apm-*",
"logs-apm.*-*",
"logs-cloud_security_posture.findings-*",
"logs-cloud_security_posture.vulnerabilities-*",
"metrics-apm-*",
"metrics-apm.*-*",
"traces-apm-*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1586,10 +1586,8 @@ public void testKibanaSystemRole() {
final IndexAbstraction indexAbstraction = mockIndexAbstraction(cspIndex);
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:foo").test(indexAbstraction), is(false));
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:bar").test(indexAbstraction), is(false));
assertThat(
kibanaRole.indices().allowedIndicesMatcher(TransportDeleteIndexAction.TYPE.name()).test(indexAbstraction),
is(false)
);
// Ensure privileges necessary for ILM policies in Cloud Security Posture Package
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportDeleteIndexAction.TYPE.name()).test(indexAbstraction), is(true));
assertThat(kibanaRole.indices().allowedIndicesMatcher(GetIndexAction.NAME).test(indexAbstraction), is(true));
assertThat(
kibanaRole.indices().allowedIndicesMatcher(TransportCreateIndexAction.TYPE.name()).test(indexAbstraction),
Expand All @@ -1613,10 +1611,9 @@ public void testKibanaSystemRole() {
final IndexAbstraction indexAbstraction = mockIndexAbstraction(cspIndex);
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:foo").test(indexAbstraction), is(false));
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:bar").test(indexAbstraction), is(false));
assertThat(
kibanaRole.indices().allowedIndicesMatcher(TransportDeleteIndexAction.TYPE.name()).test(indexAbstraction),
is(false)
);
// Ensure privileges necessary for ILM policies in Cloud Security Posture Package
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportDeleteIndexAction.TYPE.name()).test(indexAbstraction), is(true));
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportDeleteIndexAction.TYPE.name()).test(indexAbstraction), is(true));
assertThat(kibanaRole.indices().allowedIndicesMatcher(GetIndexAction.NAME).test(indexAbstraction), is(true));
assertThat(
kibanaRole.indices().allowedIndicesMatcher(TransportCreateIndexAction.TYPE.name()).test(indexAbstraction),
Expand Down Expand Up @@ -1710,6 +1707,7 @@ public void testKibanaSystemRole() {
kibanaRole.indices().allowedIndicesMatcher("indices:monitor/" + randomAlphaOfLengthBetween(3, 8)).test(indexAbstraction),
is(true)
);

});

// cloud_defend
Expand Down

0 comments on commit 2e9ff9a

Please sign in to comment.