Skip to content

Commit 7412064

Browse files
committed
Test write
1 parent 6de6b6d commit 7412064

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

x-pack/plugin/security/qa/security-trial/src/javaRestTest/java/org/elasticsearch/xpack/security/FailureStoreSecurityRestIT.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,20 @@ public class FailureStoreSecurityRestIT extends SecurityOnTrialLicenseRestTestCa
3434
private static final String DATA_ACCESS_USER = "data_access_user";
3535
private static final String FAILURE_STORE_ACCESS_USER = "failure_store_access_user";
3636
private static final String BOTH_ACCESS_USER = "both_access_user";
37+
private static final String WRITE_ACCESS_USER = "write_access_user";
3738
private static final SecureString PASSWORD = new SecureString("elastic-password");
3839

3940
@SuppressWarnings("unchecked")
4041
public void testFailureStoreAccess() throws IOException {
4142
String dataAccessRole = "data_access";
4243
String failureStoreAccessRole = "failure_store_access";
4344
String bothAccessRole = "both_access";
45+
String writeAccessRole = "write_access";
4446

4547
createUser(DATA_ACCESS_USER, PASSWORD, List.of(dataAccessRole));
4648
createUser(FAILURE_STORE_ACCESS_USER, PASSWORD, List.of(failureStoreAccessRole));
4749
createUser(BOTH_ACCESS_USER, PASSWORD, List.of(bothAccessRole));
50+
createUser(WRITE_ACCESS_USER, PASSWORD, List.of(writeAccessRole));
4851

4952
upsertRole(Strings.format("""
5053
{
@@ -60,10 +63,16 @@ public void testFailureStoreAccess() throws IOException {
6063
}"""), failureStoreAccessRole);
6164
upsertRole(Strings.format("""
6265
{
63-
"description": "Role with failure store access",
66+
"description": "Role with both data and failure store access",
6467
"cluster": ["all"],
6568
"indices": [{"names": ["test*"], "privileges": ["read", "read_failures"]}]
6669
}"""), bothAccessRole);
70+
upsertRole(Strings.format("""
71+
{
72+
"description": "Role with regular write access without failure store access",
73+
"cluster": ["all"],
74+
"indices": [{"names": ["test*"], "privileges": ["write", "auto_configure"]}]
75+
}"""), writeAccessRole);
6776

6877
createTemplates();
6978
List<String> docIds = populateDataStreamWithBulkRequest();
@@ -263,7 +272,7 @@ private List<String> populateDataStreamWithBulkRequest() throws IOException {
263272
{ "create" : { "_index" : "test1", "_id" : "2" } }
264273
{ "@timestamp": 2, "age" : "this should be an int", "name" : "jack", "email" : "[email protected]" }
265274
""");
266-
Response response = adminClient().performRequest(bulkRequest);
275+
Response response = performRequest(WRITE_ACCESS_USER, bulkRequest);
267276
assertOK(response);
268277
// we need this dance because the ID for the failed document is random, **not** 2
269278
Map<String, Object> stringObjectMap = responseAsMap(response);

0 commit comments

Comments
 (0)