Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow read template with cluster monitor privilege #82046

Merged
merged 2 commits into from
Jan 5, 2022

Conversation

tvernum
Copy link
Contributor

@tvernum tvernum commented Dec 23, 2021

All three template types (legacy templates, composable index templates
and component templates) are stored in cluster state metadata
(in fields "templates", "index_template" and "component_template").
This cluster state is readable (via GET /_cluster/state) for users who
have the monitor privilege at the cluster level. However, calling the
explicit read endpoints for these templates required the
manage_index_templates privilege.

This change grants access to the template specific retrieval APIs for
all users (or API Keys) with the cluster monitor privilege so that they
can make use of these fit-for-purpose APIs instead of parsing data
directly from cluster metadata

Relates: elastic/beats#29554
Relates: #78832

All three template types (legacy templates, composable index templates
and component templates) are stored in cluster state metadata
(in fields "templates", "index_template" and "component_template").
This cluster state is readable (via GET /_cluster/state) for users who
have the monitor privilege at the cluster level. However, calling the
explicit read endpoints for these templates required the
manage_index_templates privilege.

This change grants access to the template specific retrieval APIs for
all users (or API Keys) with the cluster monitor privilge so that they
can make use of these fit-for-purpose APIs instead of parsing data
directly from cluster metadata

Relates: elastic/beats#29554, elastic#78832
@tvernum tvernum added >enhancement :Data Management/Indices APIs APIs to create and manage indices and templates :Security/Authorization Roles, Privileges, DLS/FLS, RBAC/ABAC v8.0.0 v8.1.0 v7.17.0 labels Dec 23, 2021
@elasticmachine elasticmachine added Team:Data Management Meta label for data/management team Team:Security Meta label for security team labels Dec 23, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

@elasticmachine
Copy link
Collaborator

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

Copy link
Contributor

@jakelandis jakelandis left a comment

Choose a reason for hiding this comment

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

It feels a bit off to have indices:admin/[template|component_template|index_template]/get working as a cluster:monitor/* . I understand changing the name is technically non-passive so maybe the question is specific to 8.0.0 ... but I wonder if it would be better to change the name of the actions to indices:monitor/[template|component_template|index_template]/get and update the MONITOR_PATTERN to include both cluster:monitor/* and indices/monitor/* ? Some other existing actions would come along for the ride, but it looks like that might have been the original intent of those actions.

FWIW, I am fine with the change as-is for 7.17.

@tvernum
Copy link
Contributor Author

tvernum commented Dec 30, 2021

I does feel a bit off, but I think the issue is that we're hitting the limits of what you can reasonably do with a hierarchical naming system.

If we rename the Get actions, then it means that the template actions are no longer under a single hierarchy and anyone with existing roles like:

"cluster": [ "indices:admin/template/*" ]

would no longer have access to get templates.

I'm not opposed to renaming the action, but I think this is a sign that we're getting to the point where relying on a action naming system is no longer sufficient for us.

Copy link
Contributor

@albertzaharovits albertzaharovits left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

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

LGTM, I have the same concerns as Jake, but I understand the limitations with this system for now. In the future maybe we can address it better :)

@tvernum
Copy link
Contributor Author

tvernum commented Jan 5, 2022

@elasticmachine update branch

@tvernum tvernum added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Jan 5, 2022
@elasticsearchmachine elasticsearchmachine merged commit 1e57062 into elastic:master Jan 5, 2022
tvernum added a commit to tvernum/elasticsearch that referenced this pull request Jan 5, 2022
All three template types (legacy templates, composable index templates
and component templates) are stored in cluster state metadata (in fields
"templates", "index_template" and "component_template"). This cluster
state is readable (via GET /_cluster/state) for users who have the
monitor privilege at the cluster level. However, calling the explicit
read endpoints for these templates required the manage_index_templates
privilege. This change grants access to the template specific retrieval
APIs for all users (or API Keys) with the cluster monitor privilege so
that they can make use of these fit-for-purpose APIs instead of parsing
data directly from cluster metadata Relates:
elastic/beats#29554 Relates: elastic#78832
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.0
7.17 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 82046

tvernum added a commit to tvernum/elasticsearch that referenced this pull request Jan 5, 2022
All three template types (legacy templates, composable index templates
and component templates) are stored in cluster state metadata
(in fields "templates", "index_template" and "component_template").
This cluster state is readable (via GET /_cluster/state) for users who
have the monitor privilege at the cluster level. However, calling the
explicit read endpoints for these templates required the
manage_index_templates privilege.

This change grants access to the template specific retrieval APIs for
all users (or API Keys) with the cluster monitor privilge so that they
can make use of these fit-for-purpose APIs instead of parsing data
directly from cluster metadata

Relates: elastic/beats#29554, elastic#78832
Backport of: elastic#82046
elasticsearchmachine pushed a commit that referenced this pull request Jan 5, 2022
All three template types (legacy templates, composable index templates
and component templates) are stored in cluster state metadata (in fields
"templates", "index_template" and "component_template"). This cluster
state is readable (via GET /_cluster/state) for users who have the
monitor privilege at the cluster level. However, calling the explicit
read endpoints for these templates required the manage_index_templates
privilege. This change grants access to the template specific retrieval
APIs for all users (or API Keys) with the cluster monitor privilege so
that they can make use of these fit-for-purpose APIs instead of parsing
data directly from cluster metadata Relates:
elastic/beats#29554 Relates: #78832
tvernum added a commit that referenced this pull request Jan 5, 2022
All three template types (legacy templates, composable index templates
and component templates) are stored in cluster state metadata
(in fields "templates", "index_template" and "component_template").
This cluster state is readable (via GET /_cluster/state) for users who
have the monitor privilege at the cluster level. However, calling the
explicit read endpoints for these templates required the
manage_index_templates privilege.

This change grants access to the template specific retrieval APIs for
all users (or API Keys) with the cluster monitor privilge so that they
can make use of these fit-for-purpose APIs instead of parsing data
directly from cluster metadata

Relates: elastic/beats#29554, #78832
Backport of: #82046
astefan pushed a commit to astefan/elasticsearch that referenced this pull request Jan 7, 2022
All three template types (legacy templates, composable index templates
and component templates) are stored in cluster state metadata (in fields
"templates", "index_template" and "component_template"). This cluster
state is readable (via GET /_cluster/state) for users who have the
monitor privilege at the cluster level. However, calling the explicit
read endpoints for these templates required the manage_index_templates
privilege. This change grants access to the template specific retrieval
APIs for all users (or API Keys) with the cluster monitor privilege so
that they can make use of these fit-for-purpose APIs instead of parsing
data directly from cluster metadata Relates:
elastic/beats#29554 Relates: elastic#78832
astefan pushed a commit to astefan/elasticsearch that referenced this pull request Jan 7, 2022
All three template types (legacy templates, composable index templates
and component templates) are stored in cluster state metadata (in fields
"templates", "index_template" and "component_template"). This cluster
state is readable (via GET /_cluster/state) for users who have the
monitor privilege at the cluster level. However, calling the explicit
read endpoints for these templates required the manage_index_templates
privilege. This change grants access to the template specific retrieval
APIs for all users (or API Keys) with the cluster monitor privilege so
that they can make use of these fit-for-purpose APIs instead of parsing
data directly from cluster metadata Relates:
elastic/beats#29554 Relates: elastic#78832
@albertzaharovits albertzaharovits removed the :Data Management/Indices APIs APIs to create and manage indices and templates label Jan 20, 2022
@elasticmachine elasticmachine removed the Team:Data Management Meta label for data/management team label Jan 20, 2022
@albertzaharovits albertzaharovits added the :Data Management/Indices APIs APIs to create and manage indices and templates label Jan 20, 2022
@elasticmachine elasticmachine added the Team:Data Management Meta label for data/management team label Jan 20, 2022
@albertzaharovits albertzaharovits removed the :Data Management/Indices APIs APIs to create and manage indices and templates label Jan 25, 2022
@elasticmachine elasticmachine removed the Team:Data Management Meta label for data/management team label Jan 25, 2022
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/Authorization Roles, Privileges, DLS/FLS, RBAC/ABAC Team:Security Meta label for security team v7.17.0 v8.0.0 v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants