Skip to content

Commit

Permalink
Allow kibana_system user to manage .reindexed-v8-internal.alerts
Browse files Browse the repository at this point in the history
…indices (elastic#118959)

* Adding reindexed alerts as data backing index prefixes

* Update docs/changelog/118959.yaml

* Update docs/changelog/118959.yaml

---------

Co-authored-by: Ersin Erdal <[email protected]>
  • Loading branch information
ymao1 and ersin-erdal committed Jan 2, 2025
1 parent 261cf2c commit f278373
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
5 changes: 5 additions & 0 deletions docs/changelog/118959.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 118959
summary: Allow kibana_system user to manage .reindexed-v8-internal.alerts indices
area: Authorization
type: enhancement
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,10 @@ static RoleDescriptor kibanaSystem(String name) {
// Observability, etc.
// Kibana system user creates these indices; reads / writes to them via the
// aliases (see below).
RoleDescriptor.IndicesPrivileges.builder().indices(ReservedRolesStore.ALERTS_BACKING_INDEX).privileges("all").build(),
RoleDescriptor.IndicesPrivileges.builder()
.indices(ReservedRolesStore.ALERTS_BACKING_INDEX, ReservedRolesStore.ALERTS_BACKING_INDEX_REINDEXED)
.privileges("all")
.build(),
// "Alerts as data" public index aliases used in Security Solution,
// Observability, etc.
// Kibana system user uses them to read / write alerts.
Expand All @@ -245,7 +248,7 @@ static RoleDescriptor kibanaSystem(String name) {
// Kibana system user creates these indices; reads / writes to them via the
// aliases (see below).
RoleDescriptor.IndicesPrivileges.builder()
.indices(ReservedRolesStore.PREVIEW_ALERTS_BACKING_INDEX_ALIAS)
.indices(ReservedRolesStore.PREVIEW_ALERTS_BACKING_INDEX, ReservedRolesStore.PREVIEW_ALERTS_BACKING_INDEX_REINDEXED)
.privileges("all")
.build(),
// Endpoint / Fleet policy responses. Kibana requires read access to send
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class ReservedRolesStore implements BiConsumer<Set<String>, ActionListene

/** Alerts, Rules, Cases (RAC) index used by multiple solutions */
public static final String ALERTS_BACKING_INDEX = ".internal.alerts*";
public static final String ALERTS_BACKING_INDEX_REINDEXED = ".reindexed-v8-internal.alerts*";

/** Alerts, Rules, Cases (RAC) index used by multiple solutions */
public static final String ALERTS_INDEX_ALIAS = ".alerts*";
Expand All @@ -55,7 +56,8 @@ public class ReservedRolesStore implements BiConsumer<Set<String>, ActionListene
public static final String PREVIEW_ALERTS_INDEX_ALIAS = ".preview.alerts*";

/** Alerts, Rules, Cases (RAC) preview index used by multiple solutions */
public static final String PREVIEW_ALERTS_BACKING_INDEX_ALIAS = ".internal.preview.alerts*";
public static final String PREVIEW_ALERTS_BACKING_INDEX = ".internal.preview.alerts*";
public static final String PREVIEW_ALERTS_BACKING_INDEX_REINDEXED = ".reindexed-v8-internal.preview.alerts*";

/** "Security Solutions" only lists index for value lists for detections */
public static final String LISTS_INDEX = ".lists-*";
Expand Down Expand Up @@ -933,8 +935,10 @@ private static RoleDescriptor buildEditorRoleDescriptor() {
RoleDescriptor.IndicesPrivileges.builder()
.indices(
ReservedRolesStore.ALERTS_BACKING_INDEX,
ReservedRolesStore.ALERTS_BACKING_INDEX_REINDEXED,
ReservedRolesStore.ALERTS_INDEX_ALIAS,
ReservedRolesStore.PREVIEW_ALERTS_BACKING_INDEX_ALIAS,
ReservedRolesStore.PREVIEW_ALERTS_BACKING_INDEX,
ReservedRolesStore.PREVIEW_ALERTS_BACKING_INDEX_REINDEXED,
ReservedRolesStore.PREVIEW_ALERTS_INDEX_ALIAS
)
.privileges("read", "view_index_metadata", "write", "maintenance")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -614,9 +614,11 @@ public void testKibanaSystemRole() {
".apm-source-map",
ReservedRolesStore.ALERTS_LEGACY_INDEX + randomAlphaOfLength(randomIntBetween(0, 13)),
ReservedRolesStore.ALERTS_BACKING_INDEX + randomAlphaOfLength(randomIntBetween(0, 13)),
ReservedRolesStore.ALERTS_BACKING_INDEX_REINDEXED + randomAlphaOfLength(randomIntBetween(0, 13)),
ReservedRolesStore.ALERTS_INDEX_ALIAS + randomAlphaOfLength(randomIntBetween(0, 13)),
ReservedRolesStore.PREVIEW_ALERTS_INDEX_ALIAS + randomAlphaOfLength(randomIntBetween(0, 13)),
ReservedRolesStore.PREVIEW_ALERTS_BACKING_INDEX_ALIAS + randomAlphaOfLength(randomIntBetween(0, 13)),
ReservedRolesStore.PREVIEW_ALERTS_BACKING_INDEX + randomAlphaOfLength(randomIntBetween(0, 13)),
ReservedRolesStore.PREVIEW_ALERTS_BACKING_INDEX_REINDEXED + randomAlphaOfLength(randomIntBetween(0, 13)),
ReservedRolesStore.LISTS_INDEX + randomAlphaOfLength(randomIntBetween(0, 13)),
ReservedRolesStore.LISTS_ITEMS_INDEX + randomAlphaOfLength(randomIntBetween(0, 13)),
".slo-observability." + randomAlphaOfLength(randomIntBetween(0, 13))
Expand Down

0 comments on commit f278373

Please sign in to comment.