Skip to content

Commit f1f6cec

Browse files
Add new internal cross-project access user
1 parent 734a6b7 commit f1f6cec

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/user/InternalUsers.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
import org.elasticsearch.action.search.TransportSearchAction;
3030
import org.elasticsearch.action.search.TransportSearchScrollAction;
3131
import org.elasticsearch.index.reindex.ReindexAction;
32+
import org.elasticsearch.tasks.TaskCancellationService;
33+
import org.elasticsearch.transport.RemoteClusterService;
3234
import org.elasticsearch.xpack.core.XPackPlugin;
3335
import org.elasticsearch.xpack.core.ilm.action.ILMActions;
3436
import org.elasticsearch.xpack.core.security.authz.RoleDescriptor;
@@ -294,6 +296,29 @@ public class InternalUsers {
294296
)
295297
);
296298

299+
/**
300+
* Internal user that can manage a cross-project connections (e.g. handshake)
301+
* and searches (e.g. cancelling).
302+
*/
303+
public static final InternalUser CROSS_PROJECT_ACCESS_USER = new InternalUser(
304+
UsernamesField.CROSS_PROJECT_ACCESS_USER_NAME,
305+
new RoleDescriptor(
306+
UsernamesField.CROSS_PROJECT_ACCESS_ROLE_NAME,
307+
new String[] {
308+
RemoteClusterService.REMOTE_CLUSTER_HANDSHAKE_ACTION_NAME,
309+
TaskCancellationService.REMOTE_CLUSTER_BAN_PARENT_ACTION_NAME,
310+
TaskCancellationService.REMOTE_CLUSTER_CANCEL_CHILD_ACTION_NAME,
311+
"cluster:internal:data/read/esql/open_exchange",
312+
"cluster:internal:data/read/esql/exchange" },
313+
null,
314+
null,
315+
null,
316+
null,
317+
MetadataUtils.DEFAULT_RESERVED_METADATA,
318+
Map.of()
319+
)
320+
);
321+
297322
public static final SystemUser SYSTEM_USER = SystemUser.INSTANCE;
298323

299324
private static final Map<String, InternalUser> INTERNAL_USERS;
@@ -309,7 +334,8 @@ public class InternalUsers {
309334
DATA_STREAM_LIFECYCLE_USER,
310335
REINDEX_DATA_STREAM_USER,
311336
SYNONYMS_USER,
312-
LAZY_ROLLOVER_USER
337+
LAZY_ROLLOVER_USER,
338+
CROSS_PROJECT_ACCESS_USER
313339
).collect(Collectors.toUnmodifiableMap(InternalUser::principal, Function.identity()));
314340
}
315341

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/user/UsernamesField.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public final class UsernamesField {
3434
public static final String STORAGE_ROLE_NAME = "_storage";
3535
public static final String SYNONYMS_USER_NAME = "_synonyms";
3636
public static final String SYNONYMS_ROLE_NAME = "_synonyms";
37+
public static final String CROSS_PROJECT_ACCESS_USER_NAME = "_cross_project_access";
38+
public static final String CROSS_PROJECT_ACCESS_ROLE_NAME = "_cross_project_access";
3739

3840
public static final String REMOTE_MONITORING_NAME = "remote_monitoring_user";
3941
public static final String REMOTE_MONITORING_COLLECTION_ROLE = "remote_monitoring_collector";

0 commit comments

Comments
 (0)