Skip to content

Commit

Permalink
Grant editor and viewer access to profiling (elastic#100594)
Browse files Browse the repository at this point in the history
With this commit we amend the `viewer` and `editor` roles so that access
to the index patterns related to Universal Profiling is possible. The
`editor` role gets the same permissions as `viewer` for these index
patterns because it does not make sense to write to these indices
directly (i.e. instead of the collector / symbolizer doing that).
  • Loading branch information
danielmitterdorfer authored Oct 13, 2023
1 parent b517541 commit e2c1e0f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/changelog/100594.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 100594
summary: Grant editor and viewer access to profiling
area: Authorization
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ public class ReservedRolesStore implements BiConsumer<Set<String>, ActionListene
/** "Security Solutions" only lists index for value list items for detections */
public static final String LISTS_ITEMS_INDEX = ".items-*";

/** Index pattern for Universal Profiling */
public static final String UNIVERSAL_PROFILING_ALIASES = "profiling-*";
public static final String UNIVERSAL_PROFILING_BACKING_INDICES = ".profiling-*";

public static final RoleDescriptor SUPERUSER_ROLE_DESCRIPTOR = new RoleDescriptor(
"superuser",
new String[] { "all" },
Expand Down Expand Up @@ -641,6 +645,11 @@ private static RoleDescriptor buildViewerRoleDescriptor() {
RoleDescriptor.IndicesPrivileges.builder()
.indices(ReservedRolesStore.ALERTS_INDEX_ALIAS, ReservedRolesStore.PREVIEW_ALERTS_INDEX_ALIAS)
.privileges("read", "view_index_metadata")
.build(),
// Universal Profiling
RoleDescriptor.IndicesPrivileges.builder()
.indices(ReservedRolesStore.UNIVERSAL_PROFILING_ALIASES, ReservedRolesStore.UNIVERSAL_PROFILING_BACKING_INDICES)
.privileges("read", "view_index_metadata")
.build() },
new RoleDescriptor.ApplicationResourcePrivileges[] {
RoleDescriptor.ApplicationResourcePrivileges.builder()
Expand Down Expand Up @@ -684,6 +693,10 @@ private static RoleDescriptor buildEditorRoleDescriptor() {
ReservedRolesStore.PREVIEW_ALERTS_INDEX_ALIAS
)
.privileges("read", "view_index_metadata", "write", "maintenance")
.build(),
RoleDescriptor.IndicesPrivileges.builder()
.indices(ReservedRolesStore.UNIVERSAL_PROFILING_ALIASES, ReservedRolesStore.UNIVERSAL_PROFILING_BACKING_INDICES)
.privileges("read", "view_index_metadata")
.build() },
new RoleDescriptor.ApplicationResourcePrivileges[] {
RoleDescriptor.ApplicationResourcePrivileges.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3057,6 +3057,8 @@ public void testPredefinedViewerRole() {
assertOnlyReadAllowed(role, "packetbeat-" + randomIntBetween(0, 5));
assertOnlyReadAllowed(role, "winlogbeat-" + randomIntBetween(0, 5));
assertOnlyReadAllowed(role, "endgame-" + randomIntBetween(0, 5));
assertOnlyReadAllowed(role, "profiling-" + randomIntBetween(0, 5));
assertOnlyReadAllowed(role, ".profiling-" + randomIntBetween(0, 5));
assertOnlyReadAllowed(role, randomAlphaOfLength(5));

assertNoAccessAllowed(role, TestRestrictedIndices.SAMPLE_RESTRICTED_NAMES);
Expand Down Expand Up @@ -3124,6 +3126,8 @@ public void testPredefinedEditorRole() {
assertOnlyReadAllowed(role, "packetbeat-" + randomIntBetween(0, 5));
assertOnlyReadAllowed(role, "winlogbeat-" + randomIntBetween(0, 5));
assertOnlyReadAllowed(role, "endgame-" + randomIntBetween(0, 5));
assertOnlyReadAllowed(role, "profiling-" + randomIntBetween(0, 5));
assertOnlyReadAllowed(role, ".profiling-" + randomIntBetween(0, 5));
assertOnlyReadAllowed(role, randomAlphaOfLength(5));

assertReadWriteDocsAndMaintenanceButNotDeleteIndexAllowed(role, ".siem-signals-" + randomIntBetween(0, 5));
Expand Down

0 comments on commit e2c1e0f

Please sign in to comment.