Skip to content

Commit e064650

Browse files
Grant editor and viewer access to profiling (elastic#100594) (elastic#100792)
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).
1 parent 12d2dc8 commit e064650

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

docs/changelog/100594.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 100594
2+
summary: Grant editor and viewer access to profiling
3+
area: Authorization
4+
type: bug
5+
issues: []

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ public class ReservedRolesStore implements BiConsumer<Set<String>, ActionListene
6161
/** "Security Solutions" only lists index for value list items for detections */
6262
public static final String LISTS_ITEMS_INDEX = ".items-*";
6363

64+
/** Index pattern for Universal Profiling */
65+
public static final String UNIVERSAL_PROFILING_ALIASES = "profiling-*";
66+
public static final String UNIVERSAL_PROFILING_BACKING_INDICES = ".profiling-*";
67+
6468
public static final RoleDescriptor SUPERUSER_ROLE_DESCRIPTOR = new RoleDescriptor(
6569
"superuser",
6670
new String[] { "all" },
@@ -641,6 +645,11 @@ private static RoleDescriptor buildViewerRoleDescriptor() {
641645
RoleDescriptor.IndicesPrivileges.builder()
642646
.indices(ReservedRolesStore.ALERTS_INDEX_ALIAS, ReservedRolesStore.PREVIEW_ALERTS_INDEX_ALIAS)
643647
.privileges("read", "view_index_metadata")
648+
.build(),
649+
// Universal Profiling
650+
RoleDescriptor.IndicesPrivileges.builder()
651+
.indices(ReservedRolesStore.UNIVERSAL_PROFILING_ALIASES, ReservedRolesStore.UNIVERSAL_PROFILING_BACKING_INDICES)
652+
.privileges("read", "view_index_metadata")
644653
.build() },
645654
new RoleDescriptor.ApplicationResourcePrivileges[] {
646655
RoleDescriptor.ApplicationResourcePrivileges.builder()
@@ -684,6 +693,10 @@ private static RoleDescriptor buildEditorRoleDescriptor() {
684693
ReservedRolesStore.PREVIEW_ALERTS_INDEX_ALIAS
685694
)
686695
.privileges("read", "view_index_metadata", "write", "maintenance")
696+
.build(),
697+
RoleDescriptor.IndicesPrivileges.builder()
698+
.indices(ReservedRolesStore.UNIVERSAL_PROFILING_ALIASES, ReservedRolesStore.UNIVERSAL_PROFILING_BACKING_INDICES)
699+
.privileges("read", "view_index_metadata")
687700
.build() },
688701
new RoleDescriptor.ApplicationResourcePrivileges[] {
689702
RoleDescriptor.ApplicationResourcePrivileges.builder()

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3057,6 +3057,8 @@ public void testPredefinedViewerRole() {
30573057
assertOnlyReadAllowed(role, "packetbeat-" + randomIntBetween(0, 5));
30583058
assertOnlyReadAllowed(role, "winlogbeat-" + randomIntBetween(0, 5));
30593059
assertOnlyReadAllowed(role, "endgame-" + randomIntBetween(0, 5));
3060+
assertOnlyReadAllowed(role, "profiling-" + randomIntBetween(0, 5));
3061+
assertOnlyReadAllowed(role, ".profiling-" + randomIntBetween(0, 5));
30603062
assertOnlyReadAllowed(role, randomAlphaOfLength(5));
30613063

30623064
assertNoAccessAllowed(role, TestRestrictedIndices.SAMPLE_RESTRICTED_NAMES);
@@ -3124,6 +3126,8 @@ public void testPredefinedEditorRole() {
31243126
assertOnlyReadAllowed(role, "packetbeat-" + randomIntBetween(0, 5));
31253127
assertOnlyReadAllowed(role, "winlogbeat-" + randomIntBetween(0, 5));
31263128
assertOnlyReadAllowed(role, "endgame-" + randomIntBetween(0, 5));
3129+
assertOnlyReadAllowed(role, "profiling-" + randomIntBetween(0, 5));
3130+
assertOnlyReadAllowed(role, ".profiling-" + randomIntBetween(0, 5));
31273131
assertOnlyReadAllowed(role, randomAlphaOfLength(5));
31283132

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

0 commit comments

Comments
 (0)