Skip to content

Commit bbfa11d

Browse files
adcoelhoelasticsearchmachineelasticmachine
authored
[ResponseOps] Granting kibana_system role access to the cases analytics indices (elastic#129414) (elastic#131288)
* 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 b60098b commit bbfa11d

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
@@ -255,6 +257,9 @@ static RoleDescriptor kibanaSystem(String name) {
255257
// Observability, etc.
256258
// Kibana system user uses them to read / write alerts.
257259
RoleDescriptor.IndicesPrivileges.builder().indices(ReservedRolesStore.ALERTS_INDEX_ALIAS).privileges("all").build(),
260+
// "Cases as data" analytics indexes and aliases
261+
RoleDescriptor.IndicesPrivileges.builder().indices(ReservedRolesStore.CASES_ANALYTICS_INDEXES).privileges("all").build(),
262+
RoleDescriptor.IndicesPrivileges.builder().indices(ReservedRolesStore.CASES_ANALYTICS_ALIASES).privileges("all").build(),
258263
// "Alerts as data" public index alias used in Security Solution
259264
// Kibana system user uses them to read / write alerts.
260265
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
@@ -53,6 +53,10 @@ public class ReservedRolesStore implements BiConsumer<Set<String>, ActionListene
5353
/** Alerts, Rules, Cases (RAC) index used by multiple solutions */
5454
public static final String ALERTS_INDEX_ALIAS = ".alerts*";
5555

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

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
@@ -436,6 +436,10 @@ public void testKibanaSystemRole() {
436436
assertThat(kibanaRole.cluster().check(ClusterUpdateSettingsAction.NAME, request, authentication), is(false));
437437
assertThat(kibanaRole.cluster().check(MonitoringBulkAction.NAME, request, authentication), is(true));
438438

439+
// Script
440+
assertTrue(kibanaRole.cluster().check("cluster:admin/script/put", request, authentication));
441+
assertTrue(kibanaRole.cluster().check("cluster:admin/script/get", request, authentication));
442+
439443
// Inference
440444
assertTrue(kibanaRole.cluster().check("cluster:admin/xpack/inference/get", request, authentication));
441445
assertTrue(kibanaRole.cluster().check("cluster:admin/xpack/inference/put", request, authentication));
@@ -611,6 +615,8 @@ public void testKibanaSystemRole() {
611615
".apm-agent-configuration",
612616
".apm-custom-link",
613617
".apm-source-map",
618+
ReservedRolesStore.CASES_ANALYTICS_INDEXES + randomAlphaOfLength(randomIntBetween(0, 13)),
619+
ReservedRolesStore.CASES_ANALYTICS_ALIASES + randomAlphaOfLength(randomIntBetween(0, 13)),
614620
ReservedRolesStore.ALERTS_LEGACY_INDEX + randomAlphaOfLength(randomIntBetween(0, 13)),
615621
ReservedRolesStore.ALERTS_LEGACY_INDEX_REINDEXED_V8 + randomAlphaOfLength(randomIntBetween(0, 13)),
616622
ReservedRolesStore.ALERTS_BACKING_INDEX + randomAlphaOfLength(randomIntBetween(0, 13)),

0 commit comments

Comments
 (0)