Skip to content

Commit 39a3e80

Browse files
adcoelhoelasticsearchmachineelasticmachine
authored
[ResponseOps] Granting kibana_system role access to the cases analytics indices (#129414)
* Update kibana system user permissions for cases analytics index. * [CI] Auto commit changes from spotless * Add permissions for aliases. Create constants for indexes and aliases. Update tests. * [CI] Auto commit changes from spotless --------- Co-authored-by: elasticsearchmachine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
1 parent 4aa83e2 commit 39a3e80

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ static RoleDescriptor kibanaSystem(String name) {
100100
// The symbolic constant for this one is in SecurityActionMapper, so not
101101
// accessible from X-Pack core
102102
"cluster:admin/analyze",
103+
"cluster:admin/script/put",
104+
"cluster:admin/script/get",
103105
// To facilitate using the file uploader functionality
104106
"monitor_text_structure",
105107
// To cancel tasks and delete async searches
@@ -265,6 +267,9 @@ static RoleDescriptor kibanaSystem(String name) {
265267
// Observability, etc.
266268
// Kibana system user uses them to read / write alerts.
267269
RoleDescriptor.IndicesPrivileges.builder().indices(ReservedRolesStore.ALERTS_INDEX_ALIAS).privileges("all").build(),
270+
// "Cases as data" analytics indexes and aliases
271+
RoleDescriptor.IndicesPrivileges.builder().indices(ReservedRolesStore.CASES_ANALYTICS_INDEXES).privileges("all").build(),
272+
RoleDescriptor.IndicesPrivileges.builder().indices(ReservedRolesStore.CASES_ANALYTICS_ALIASES).privileges("all").build(),
268273
// "Alerts as data" public index alias used in Security Solution
269274
// Kibana system user uses them to read / write alerts.
270275
RoleDescriptor.IndicesPrivileges.builder()

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ public class ReservedRolesStore implements BiConsumer<Set<String>, ActionListene
5252
/** Alerts, Rules, Cases (RAC) index used by multiple solutions */
5353
public static final String ALERTS_INDEX_ALIAS = ".alerts*";
5454

55+
/** Cases analytics indexes and aliases */
56+
public static final String CASES_ANALYTICS_INDEXES = ".internal.cases*";
57+
public static final String CASES_ANALYTICS_ALIASES = ".cases*";
58+
5559
/** Alerts, Rules, Cases (RAC) preview index used by multiple solutions */
5660
public static final String PREVIEW_ALERTS_INDEX_ALIAS = ".preview.alerts*";
5761

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,10 @@ public void testKibanaSystemRole() {
434434
assertThat(kibanaRole.cluster().check(ClusterUpdateSettingsAction.NAME, request, authentication), is(false));
435435
assertThat(kibanaRole.cluster().check(MonitoringBulkAction.NAME, request, authentication), is(true));
436436

437+
// Script
438+
assertTrue(kibanaRole.cluster().check("cluster:admin/script/put", request, authentication));
439+
assertTrue(kibanaRole.cluster().check("cluster:admin/script/get", request, authentication));
440+
437441
// Inference
438442
assertTrue(kibanaRole.cluster().check("cluster:admin/xpack/inference/get", request, authentication));
439443
assertTrue(kibanaRole.cluster().check("cluster:admin/xpack/inference/put", request, authentication));
@@ -609,6 +613,8 @@ public void testKibanaSystemRole() {
609613
".apm-agent-configuration",
610614
".apm-custom-link",
611615
".apm-source-map",
616+
ReservedRolesStore.CASES_ANALYTICS_INDEXES + randomAlphaOfLength(randomIntBetween(0, 13)),
617+
ReservedRolesStore.CASES_ANALYTICS_ALIASES + randomAlphaOfLength(randomIntBetween(0, 13)),
612618
ReservedRolesStore.ALERTS_LEGACY_INDEX + randomAlphaOfLength(randomIntBetween(0, 13)),
613619
ReservedRolesStore.ALERTS_LEGACY_INDEX_REINDEXED_V8 + randomAlphaOfLength(randomIntBetween(0, 13)),
614620
ReservedRolesStore.ALERTS_BACKING_INDEX + randomAlphaOfLength(randomIntBetween(0, 13)),

0 commit comments

Comments
 (0)