Skip to content

Commit 5c53a66

Browse files
authored
remove dashboard only reserved role (#76507)
Removes the deprecated kibana_dashboard_only_user from the set of reserved roles in Elasticsearch as this legacy functionality is being removed from Kibana. Relates: elastic/kibana#54755.
1 parent 1d8bad6 commit 5c53a66

File tree

3 files changed

+2
-51
lines changed

3 files changed

+2
-51
lines changed

client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/SecurityDocumentationIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -705,8 +705,8 @@ public void testGetRoles() throws Exception {
705705

706706
List<Role> roles = response.getRoles();
707707
assertNotNull(response);
708-
// 31 system roles plus the three we created
709-
assertThat(roles.size(), equalTo(31 + 3));
708+
// 30 system roles plus the three we created
709+
assertThat(roles.size(), equalTo(30 + 3));
710710
}
711711

712712
{

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,6 @@ private static Map<String, RoleDescriptor> initializeReservedRoles() {
115115
null,
116116
MetadataUtils.getDeprecatedReservedMetadata("Please use Kibana feature privileges instead"),
117117
null))
118-
.put("kibana_dashboard_only_user", new RoleDescriptor(
119-
"kibana_dashboard_only_user",
120-
null,
121-
null,
122-
new RoleDescriptor.ApplicationResourcePrivileges[] {
123-
RoleDescriptor.ApplicationResourcePrivileges.builder()
124-
.application("kibana-.kibana").resources("*").privileges("read").build() },
125-
null, null,
126-
MetadataUtils.getDeprecatedReservedMetadata("Please use Kibana feature privileges instead"),
127-
null))
128118
.put(KibanaSystemUser.ROLE_NAME, kibanaSystemRoleDescriptor(KibanaSystemUser.ROLE_NAME))
129119
.put("logstash_system", new RoleDescriptor("logstash_system", new String[] { "monitor", MonitoringBulkAction.NAME},
130120
null, null, MetadataUtils.DEFAULT_RESERVED_METADATA))

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

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ public void testIsReserved() {
218218
assertThat(ReservedRolesStore.isReserved("transform_admin"), is(true));
219219
assertThat(ReservedRolesStore.isReserved("watcher_user"), is(true));
220220
assertThat(ReservedRolesStore.isReserved("watcher_admin"), is(true));
221-
assertThat(ReservedRolesStore.isReserved("kibana_dashboard_only_user"), is(true));
222221
assertThat(ReservedRolesStore.isReserved("beats_admin"), is(true));
223222
assertThat(ReservedRolesStore.isReserved(XPackUser.ROLE_NAME), is(true));
224223
assertThat(ReservedRolesStore.isReserved(AsyncSearchUser.ROLE_NAME), is(true));
@@ -1037,44 +1036,6 @@ public void testReportingUserRole() {
10371036
assertNoAccessAllowed(reportingUserRole, RestrictedIndicesNames.ASYNC_SEARCH_PREFIX + randomAlphaOfLengthBetween(0, 2));
10381037
}
10391038

1040-
public void testKibanaDashboardOnlyUserRole() {
1041-
final TransportRequest request = mock(TransportRequest.class);
1042-
final Authentication authentication = mock(Authentication.class);
1043-
1044-
RoleDescriptor roleDescriptor = new ReservedRolesStore().roleDescriptor("kibana_dashboard_only_user");
1045-
assertNotNull(roleDescriptor);
1046-
assertThat(roleDescriptor.getMetadata(), hasEntry("_reserved", true));
1047-
assertThat(roleDescriptor.getMetadata(), hasEntry("_deprecated", true));
1048-
1049-
Role dashboardsOnlyUserRole = Role.builder(roleDescriptor, null).build();
1050-
assertThat(dashboardsOnlyUserRole.cluster().check(ClusterHealthAction.NAME, request, authentication), is(false));
1051-
assertThat(dashboardsOnlyUserRole.cluster().check(ClusterStateAction.NAME, request, authentication), is(false));
1052-
assertThat(dashboardsOnlyUserRole.cluster().check(ClusterStatsAction.NAME, request, authentication), is(false));
1053-
assertThat(dashboardsOnlyUserRole.cluster().check(PutIndexTemplateAction.NAME, request, authentication), is(false));
1054-
assertThat(dashboardsOnlyUserRole.cluster().check(ClusterRerouteAction.NAME, request, authentication), is(false));
1055-
assertThat(dashboardsOnlyUserRole.cluster().check(ClusterUpdateSettingsAction.NAME, request, authentication), is(false));
1056-
assertThat(dashboardsOnlyUserRole.cluster().check(MonitoringBulkAction.NAME, request, authentication), is(false));
1057-
assertThat(dashboardsOnlyUserRole.cluster().check(DelegatePkiAuthenticationAction.NAME, request, authentication), is(false));
1058-
1059-
assertThat(dashboardsOnlyUserRole.runAs().check(randomAlphaOfLengthBetween(1, 12)), is(false));
1060-
1061-
final String randomApplication = "kibana-" + randomAlphaOfLengthBetween(8, 24);
1062-
assertThat(dashboardsOnlyUserRole.application().grants(new ApplicationPrivilege(randomApplication, "app-random", "all"), "*"),
1063-
is(false));
1064-
1065-
final String application = "kibana-.kibana";
1066-
assertThat(dashboardsOnlyUserRole.application().grants(new ApplicationPrivilege(application, "app-foo", "foo"), "*"), is(false));
1067-
assertThat(dashboardsOnlyUserRole.application().grants(new ApplicationPrivilege(application, "app-all", "all"), "*"), is(false));
1068-
assertThat(dashboardsOnlyUserRole.application().grants(new ApplicationPrivilege(application, "app-read", "read"), "*"), is(true));
1069-
1070-
final String applicationWithRandomIndex = "kibana-.kibana_" + randomAlphaOfLengthBetween(8, 24);
1071-
assertThat(dashboardsOnlyUserRole.application().grants(
1072-
new ApplicationPrivilege(applicationWithRandomIndex, "app-random-index", "all"), "*"), is(false));
1073-
1074-
assertNoAccessAllowed(dashboardsOnlyUserRole, RestrictedIndicesNames.RESTRICTED_NAMES);
1075-
assertNoAccessAllowed(dashboardsOnlyUserRole, RestrictedIndicesNames.ASYNC_SEARCH_PREFIX + randomAlphaOfLengthBetween(0, 2));
1076-
}
1077-
10781039
public void testSuperuserRole() {
10791040
final TransportRequest request = mock(TransportRequest.class);
10801041
final Authentication authentication = mock(Authentication.class);

0 commit comments

Comments
 (0)