|
63 | 63 | import static org.elasticsearch.xpack.core.security.test.TestRestrictedIndices.SECURITY_MAIN_ALIAS; |
64 | 64 | import static org.elasticsearch.xpack.core.security.test.TestRestrictedIndices.SECURITY_TOKENS_ALIAS; |
65 | 65 | import static org.elasticsearch.xpack.core.security.user.UsernamesField.REINDEX_DATA_STREAM_NAME; |
| 66 | +import static org.hamcrest.Matchers.anyOf; |
66 | 67 | import static org.hamcrest.Matchers.arrayContaining; |
67 | 68 | import static org.hamcrest.Matchers.equalTo; |
68 | 69 | import static org.hamcrest.Matchers.hasSize; |
@@ -244,10 +245,17 @@ public void testDataStreamLifecycleUser() { |
244 | 245 | assertThat(role.application(), is(ApplicationPermission.NONE)); |
245 | 246 | assertThat(role.remoteIndices(), is(RemoteIndicesPermission.NONE)); |
246 | 247 |
|
247 | | - final List<String> allowedSystemDataStreams = Arrays.asList(".fleet-actions-results", ".fleet-fileds*"); |
| 248 | + final List<String> allowedFleetSystemDataStreams = Arrays.asList(".fleet-actions-results", ".fleet-fileds*"); |
| 249 | + final List<String> allowedKibanaSystemDataStreams = List.of(".kibana-reporting"); |
248 | 250 | for (var group : role.indices().groups()) { |
249 | 251 | if (group.allowRestrictedIndices()) { |
250 | | - assertThat(group.indices(), arrayContaining(allowedSystemDataStreams.toArray(new String[0]))); |
| 252 | + assertThat( |
| 253 | + group.indices(), |
| 254 | + anyOf( |
| 255 | + arrayContaining(allowedFleetSystemDataStreams.toArray(new String[0])), |
| 256 | + arrayContaining(allowedKibanaSystemDataStreams.toArray(new String[0])) |
| 257 | + ) |
| 258 | + ); |
251 | 259 | } |
252 | 260 | } |
253 | 261 |
|
@@ -290,7 +298,25 @@ public void testDataStreamLifecycleUser() { |
290 | 298 | true |
291 | 299 | ); |
292 | 300 |
|
293 | | - allowedSystemDataStreams.forEach(allowedSystemDataStream -> { |
| 301 | + allowedFleetSystemDataStreams.forEach(allowedSystemDataStream -> { |
| 302 | + checkIndexAccess(role, randomFrom(sampleSystemDataStreamActions), allowedSystemDataStream, true); |
| 303 | + checkIndexAccess( |
| 304 | + role, |
| 305 | + randomFrom(sampleSystemDataStreamActions), |
| 306 | + DataStream.BACKING_INDEX_PREFIX + allowedSystemDataStream + randomAlphaOfLengthBetween(4, 8), |
| 307 | + true |
| 308 | + ); |
| 309 | + |
| 310 | + checkIndexAccess(role, randomFrom(sampleSystemDataStreamActions), allowedSystemDataStream + "::failures", true); |
| 311 | + checkIndexAccess( |
| 312 | + role, |
| 313 | + randomFrom(sampleSystemDataStreamActions), |
| 314 | + DataStream.FAILURE_STORE_PREFIX + allowedSystemDataStream + randomAlphaOfLengthBetween(4, 8), |
| 315 | + true |
| 316 | + ); |
| 317 | + }); |
| 318 | + |
| 319 | + allowedKibanaSystemDataStreams.forEach(allowedSystemDataStream -> { |
294 | 320 | checkIndexAccess(role, randomFrom(sampleSystemDataStreamActions), allowedSystemDataStream, true); |
295 | 321 | checkIndexAccess( |
296 | 322 | role, |
|
0 commit comments