Skip to content

Don't require separate privilege for internal detail of put pipeline#60106

Merged
droberts195 merged 2 commits intoelastic:masterfrom
droberts195:hide_put_pipeline_internal_detail
Jul 27, 2020
Merged

Don't require separate privilege for internal detail of put pipeline#60106
droberts195 merged 2 commits intoelastic:masterfrom
droberts195:hide_put_pipeline_internal_detail

Conversation

@droberts195
Copy link
Copy Markdown

Putting an ingest pipeline used to require that the user calling
it had permission to get nodes info as well as permission to
manage ingest. This was due to an internal implementaton detail
that was not visible to the end user.

This change alters the behaviour so that a user with the
manage_pipeline cluster privilege can put an ingest pipeline
regardless of whether they have the separate privilege to get
nodes info. The internal implementation detail now runs as
the internal _xpack user when security is enabled.

Fixes #60041

Putting an ingest pipeline used to require that the user calling
it had permission to get nodes info as well as permission to
manage ingest.  This was due to an internal implementaton detail
that was not visible to the end user.

This change alters the behaviour so that a user with the
manage_pipeline cluster privilege can put an ingest pipeline
regardless of whether they have the separate privilege to get
nodes info.  The internal implementation detail now runs as
the internal _xpack user when security is enabled.

Fixes elastic#60041
There is no test suite that specifically tests ingest with
different levels of security privileges, so I used the ML
with security suite.  There were 3 tests of the inference
ingest processor that were excluded from this suite because
none of the users we were testing with had permission to
create an ingest pipeline.  Previously they would have
needed both the ingest_admin and monitor roles to do this.
After the core change in this PR they just require ingest_admin.
It could be argued that adding ingest_admin to the ml_admin
user used by the tests is dodgy as we could then miss the
situation where ingest_admin was required to use all ML
functionality.  However, this is extremely unlikely and the
benefit of adding this role to the ml_admin user is that
then we can test that using ML inference in ingest works
with a sensible set of user roles - previously we were not
testing ML inference in ingest with a privilege level below
superuser.
@droberts195 droberts195 added >bug :Distributed/Ingest Node Execution or management of Ingest Pipelines :ml Machine learning :Security/Authorization Roles, Privileges, DLS/FLS, RBAC/ABAC v8.0.0 v7.9.0 v7.10.0 labels Jul 23, 2020
@elasticmachine
Copy link
Copy Markdown
Collaborator

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

@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-core-features (:Core/Features/Ingest)

@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/ml-core (:ml)

@elasticmachine elasticmachine added Team:Security Meta label for security team Team:Data Management (obsolete) DO NOT USE. This team no longer exists. labels Jul 23, 2020
@droberts195
Copy link
Copy Markdown
Author

Note regarding the testing:

As far as I can see there is no test suite that specifically tests ingest with different levels of security privileges, so I used the ML with security suite. There were 3 tests of the inference ingest processor that were excluded from this suite because none of the users we were testing with had permission to create an ingest pipeline. Previously they would have needed both the ingest_admin and monitor roles to do this. After the core change in this PR they just require ingest_admin. It could be argued that adding ingest_admin to the ml_admin user used by the tests is dodgy as we could then miss the situation where ingest_admin was required to use all ML functionality. However, this is extremely unlikely and the benefit of adding this role to the ml_admin user is that then we can test that using ML inference in ingest works with a sensible set of user roles - previously we were not testing ML inference in ingest with a privilege level below superuser.

Copy link
Copy Markdown

@przemekwitek przemekwitek 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
Copy Markdown
Contributor

@danhermann danhermann left a comment

Choose a reason for hiding this comment

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

This LGTM but I would like someone from @elastic/es-security to look it over to ensure there are no subtleties involved in changing the user for the nodes info call.

Copy link
Copy Markdown
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. I think it makes sense to add a new ingest origin given the current and potential future need.

A minor comment (feel free to ignore) is that we have some inconsistency in handlilng origins from the core: The tasks origin and the new one are differently referenced in AuthorizationUtils, while persistent_tasks is duplicated in ClientHelper. Either way is fine with me, but consistency would be great.

@droberts195
Copy link
Copy Markdown
Author

while persistent_tasks is duplicated in ClientHelper.

@ywangd I did actually tidy that up in my first local version of this change, but then thought better of it because the transport client still exists in 7.x and removing public constants from classes that are available in the transport client could break people's code. How about I merge this PR as-is, then do another small PR just for master that removes persistent_tasks from ClientHelper? (The reason it's there is a legacy from 5.x, when persistent tasks was part of X-Pack.)

@ywangd
Copy link
Copy Markdown
Member

ywangd commented Jul 27, 2020

removing public constants from classes that are available in the transport client could break people's code

This is a great point and thanks for explaining the history side of things. Yes I agree to merge it as is and fix it later for master only.

@droberts195 droberts195 merged commit 8543197 into elastic:master Jul 27, 2020
@droberts195 droberts195 deleted the hide_put_pipeline_internal_detail branch July 27, 2020 08:46
droberts195 added a commit to droberts195/elasticsearch that referenced this pull request Jul 27, 2020
Putting an ingest pipeline used to require that the user calling
it had permission to get nodes info as well as permission to
manage ingest.  This was due to an internal implementaton detail
that was not visible to the end user.

This change alters the behaviour so that a user with the
manage_pipeline cluster privilege can put an ingest pipeline
regardless of whether they have the separate privilege to get
nodes info.  The internal implementation detail now runs as
the internal _xpack user when security is enabled.

Backport of elastic#60106
droberts195 added a commit to droberts195/elasticsearch that referenced this pull request Jul 27, 2020
Putting an ingest pipeline used to require that the user calling
it had permission to get nodes info as well as permission to
manage ingest.  This was due to an internal implementaton detail
that was not visible to the end user.

This change alters the behaviour so that a user with the
manage_pipeline cluster privilege can put an ingest pipeline
regardless of whether they have the separate privilege to get
nodes info.  The internal implementation detail now runs as
the internal _xpack user when security is enabled.

Backport of elastic#60106
@droberts195
Copy link
Copy Markdown
Author

fix it later for master only.

This is done in #60192

droberts195 added a commit that referenced this pull request Jul 27, 2020
…60190)

Putting an ingest pipeline used to require that the user calling
it had permission to get nodes info as well as permission to
manage ingest.  This was due to an internal implementaton detail
that was not visible to the end user.

This change alters the behaviour so that a user with the
manage_pipeline cluster privilege can put an ingest pipeline
regardless of whether they have the separate privilege to get
nodes info.  The internal implementation detail now runs as
the internal _xpack user when security is enabled.

Backport of #60106
droberts195 added a commit that referenced this pull request Jul 27, 2020
…60191)

Putting an ingest pipeline used to require that the user calling
it had permission to get nodes info as well as permission to
manage ingest.  This was due to an internal implementaton detail
that was not visible to the end user.

This change alters the behaviour so that a user with the
manage_pipeline cluster privilege can put an ingest pipeline
regardless of whether they have the separate privilege to get
nodes info.  The internal implementation detail now runs as
the internal _xpack user when security is enabled.

Backport of #60106
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>bug :Distributed/Ingest Node Execution or management of Ingest Pipelines :ml Machine learning :Security/Authorization Roles, Privileges, DLS/FLS, RBAC/ABAC Team:Data Management (obsolete) DO NOT USE. This team no longer exists. Team:Security Meta label for security team v7.9.0 v7.10.0 v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

manage_pipeline requires nodes info privilege to create pipeline

6 participants