Repository navigation
[ML] Categorization examples privilege check - #57375
jgowdyelastic merged 8 commits into
Conversation
abfd38c to
9db4c01
Compare
|
Pinging @elastic/ml-ui (:ml) |
peteharverson
left a comment
There was a problem hiding this comment.
A typo, but otherwise code LGTM
This is to support the ML categorization wizard. Currently cluster:admin/analyze is only provided with the "manage" cluster privilege, which is an excessive privilege level to provide access to this single feature. It means that the ML categorization wizard only works for extremely highly privileged users. Following this change the Kibana system user will be permitted to run the _analyze endpoint on supplied strings (not on an index). The ML UI will then call the _analyze endpoint as the Kibana system user after first checking that the logged-in user is permitted to create an ML job. This will mean that users with the more reasonable "manage_ml" cluster privilege will be permitted to use the ML categorization wizard. (This is also consistent with the way the ML UI will access _all_ Elasticsearch functionality when the "ML in Spaces" project is completed.) Closes elastic#51391 Relates elastic/kibana#57375
|
The corresponding Elasticsearch change is elastic/elasticsearch#52259. Please wait for that to be merged before merging this change. |
|
retest |
There was a problem hiding this comment.
As an alternative to doing the privilege check using the _has_privileges API, you can augment the reserved privilege which is assigned to both the machine_learning_admin and machine_learning_user roles and take advantage of the "API Authorization" similar to this example: https://www.elastic.co/guide/en/kibana/current/development-plugin-feature-registration.html#_example_2_dev_tools
There was a problem hiding this comment.
Have spoken to @kobelb and have agreed to leave this as is for now as upcoming spaces work will see the replacement of all privilege checks in ML.
This is to support the ML categorization wizard. Currently cluster:admin/analyze is only provided with the "manage" cluster privilege, which is an excessive privilege level to provide access to this single feature. It means that the ML categorization wizard only works for extremely highly privileged users. Following this change the Kibana system user will be permitted to run the _analyze endpoint on supplied strings (not on an index). The ML UI will then call the _analyze endpoint as the Kibana system user after first checking that the logged-in user is permitted to create an ML job. This will mean that users with the more reasonable "manage_ml" cluster privilege will be permitted to use the ML categorization wizard. (This is also consistent with the way the ML UI will access _all_ Elasticsearch functionality when the "ML in Spaces" project is completed.) Closes #51391 Relates elastic/kibana#57375
This is to support the ML categorization wizard. Currently cluster:admin/analyze is only provided with the "manage" cluster privilege, which is an excessive privilege level to provide access to this single feature. It means that the ML categorization wizard only works for extremely highly privileged users. Following this change the Kibana system user will be permitted to run the _analyze endpoint on supplied strings (not on an index). The ML UI will then call the _analyze endpoint as the Kibana system user after first checking that the logged-in user is permitted to create an ML job. This will mean that users with the more reasonable "manage_ml" cluster privilege will be permitted to use the ML categorization wizard. (This is also consistent with the way the ML UI will access _all_ Elasticsearch functionality when the "ML in Spaces" project is completed.) Closes #51391 Relates elastic/kibana#57375
2dd8218 to
fd5e62a
Compare
alvarezmelissa87
left a comment
There was a problem hiding this comment.
Latest edits LGTM ⚡️
d51ffb4 to
af4da4f
Compare
|
@elasticmachine merge upstream |
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* [ML] Categorization examples privilege check * adding privileges check to endpoint * fixing typo * moving privilege check to router * removing unused variable * rebasing master * removing comment Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* [ML] Categorization examples privilege check * adding privileges check to endpoint * fixing typo * moving privilege check to router * removing unused variable * rebasing master * removing comment Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* [ML] Categorization examples privilege check * adding privileges check to endpoint * fixing typo * moving privilege check to router * removing unused variable * rebasing master * removing comment Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This is to support the ML categorization wizard. Currently cluster:admin/analyze is only provided with the "manage" cluster privilege, which is an excessive privilege level to provide access to this single feature. It means that the ML categorization wizard only works for extremely highly privileged users. Following this change the Kibana system user will be permitted to run the _analyze endpoint on supplied strings (not on an index). The ML UI will then call the _analyze endpoint as the Kibana system user after first checking that the logged-in user is permitted to create an ML job. This will mean that users with the more reasonable "manage_ml" cluster privilege will be permitted to use the ML categorization wizard. (This is also consistent with the way the ML UI will access _all_ Elasticsearch functionality when the "ML in Spaces" project is completed.) Closes #51391 Relates elastic/kibana#57375
Changes the
categorization_field_examplesendpoint so when it calls_analyseto retrieve the tokens, it does so as the kibana internal user.Because of this change, the endpoint also now requires the user to have job creation privileges.
The endpoint returns a
403if this requirement is not met.Relates to elastic/elasticsearch#51391
cc @droberts195
Checklist
For maintainers