Skip to content

Conversation

@tvernum
Copy link
Contributor

@tvernum tvernum commented May 1, 2023

This commit adds a new internal user to security. The "_storage" user (StorageInternalUser) is intended for use when performing automatic refreshes (and, in the future, similar actions) that may not be permitted by the authenticated user.

Relates: #95506

This commit adds a new internal user to security. The "_storage" user (`StorageInternalUser`) is used to perform refreshes (and, in the future, similar actions) that may not be permitted by the authenticated user.
@tvernum tvernum added >enhancement :Security/Security Security issues without another label v8.9.0 labels May 1, 2023
@tvernum tvernum requested review from kingherc and ywangd May 1, 2023 02:42
@elasticsearchmachine elasticsearchmachine added the Team:Security Meta label for security team label May 1, 2023
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-security (Team:Security)

@elasticsearchmachine
Copy link
Collaborator

Hi @tvernum, I've created a changelog YAML for you.

Copy link
Member

@ywangd ywangd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

public static final String APM_ROLE = "apm_system";
public static final String ASYNC_SEARCH_NAME = "_async_search";
public static final String ASYNC_SEARCH_ROLE = "_async_search";
public static final String STORAGE_USER_NAME = "_storage";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Is this name a bit too generic? I don't quite get what it should be used for by just looking at the name. Maybe it is just due to my lack of context. Feel free to ignore since naming discussion can rather subjective.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume it will be a generic user for any actions that are needed in order to "write to the backing store"
We may have some existing actions that run as _system that ought to be switched over to this user.

I don't love the name, and would be happy with an alternative, but I don't think that's specifically because it's generic in the sense of "could mean many things", but because it's not a term that has an obvious meaning withini the ES code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to say that #95506 where we first intend to use this user is targeted for serverless. So another option (at least for now) could be to rename this to _serverless. But I do like the generality of _storage as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to have internal users that only exist for serverless (even if the thing they do is currently only needed on serverless). It means we need to create a new user if we want to follow the same pattern on stateful code paths.


assertThat(role.cluster().privileges(), Matchers.hasSize(0));
assertThat(role.runAs(), is(RunAsPermission.NONE));
assertThat(role.application(), is(ApplicationPermission.NONE));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: we could also assert remote indices is None, i.e.

assertThat(role.remoteIndices(), is(RemoteIndicesPermission.NONE)); 
Copy link
Contributor

@kingherc kingherc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and works as well

public static final String APM_ROLE = "apm_system";
public static final String ASYNC_SEARCH_NAME = "_async_search";
public static final String ASYNC_SEARCH_ROLE = "_async_search";
public static final String STORAGE_USER_NAME = "_storage";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to say that #95506 where we first intend to use this user is targeted for serverless. So another option (at least for now) could be to rename this to _serverless. But I do like the generality of _storage as well.

@tvernum tvernum added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label May 3, 2023
@elasticsearchmachine elasticsearchmachine merged commit 9c61c0c into elastic:main May 3, 2023
@tvernum tvernum deleted the internal-user-storage branch May 3, 2023 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) >enhancement :Security/Security Security issues without another label Team:Security Meta label for security team v8.9.0

4 participants