-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[ML] Adds option to Reauthorize transform in Management page #154736
[ML] Adds option to Reauthorize transform in Management page #154736
Conversation
…com/qn895/kibana into ml-transform-management-reauthorize
@elasticmachine merge upstream |
Pinging @elastic/ml-ui (:ml) |
.../plugins/transform/public/app/sections/transform_management/transform_management_section.tsx
Outdated
Show resolved
Hide resolved
...transform/public/app/sections/transform_management/components/transform_list/use_columns.tsx
Outdated
Show resolved
Hide resolved
...app/sections/transform_management/components/action_reauthorize/reauthorize_action_modal.tsx
Outdated
Show resolved
Hide resolved
|
||
export function isTransformApiKey(arg: any): arg is TransformAPIKey { | ||
return ( | ||
arg && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could do isPopulated(arg, ['api_key', 'encoded']) && typeof arg.encoded === string
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated here 3f64b1f
(#154736)
@@ -295,6 +303,66 @@ export function registerTransformsRoutes(routeDependencies: RouteDependencies) { | |||
) | |||
); | |||
|
|||
/** | |||
* @apiGroup Reauthorize transforms with API key generated from currently logged in suer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type suer
-> user
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated here 3f64b1f
(#154736)
@@ -5,14 +5,14 @@ | |||
* 2.0. | |||
*/ | |||
|
|||
import type { IRouter, CoreStart } from '@kbn/core/server'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep the type
exports here or is there a reason to remove them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated here 3f64b1f
(#154736)
…com/qn895/kibana into ml-transform-management-reauthorize
'xpack.transform.transformList.needsReauthorizationBadgeTooltip', | ||
{ | ||
defaultMessage: | ||
'This transform was created with insufficient permissions. You must have manage_transform cluster privileges to reauthorize and start it.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@szabosteve @lcawl is it common practice to mention specific cluster privileges that are required? Wondering as in other places we aren't so specific:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After a quick check, I found that although we rarely mention specific cluster privileges in the UI, there is precedent for doing it, for example in the APM app when you don't have the correct privileges to create anomaly detection jobs. While there is precedent, I would go without mentioning the privileges specifically. The docs mention the correct privileges and we consider them as the source of truth, so it might make sense to keep only the docs up-to-date – even if the name of the privileges is unlikely to change.
@peteharverson @lcawl WDYT?
'This transform was created with insufficient permissions. You must have manage_transform cluster privileges to reauthorize and start it.', | |
'This transform was created with insufficient permissions. Contact your administrator to request the required privileges.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to your suggestion @szabosteve to not mention the privileges specifically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated here (1a8969a)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, that's even better, thanks!
.../plugins/transform/public/app/sections/transform_management/transform_management_section.tsx
Outdated
Show resolved
Hide resolved
…ove createTransformWithHeaders
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with your example Host Risk Score packages and overall looks good.
A couple of the warning messages probably need a further edit.
'xpack.transform.transformList.needsReauthorizationBadgeTooltip', | ||
{ | ||
defaultMessage: | ||
'This transform was created with insufficient permissions. Contact your administrator to request the required privileges.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This message should be adjusted if logging in as a user with the correct permissions, otherwise it gives the impression that the current user does not have the required permissions.
Something along the lines of
This transform was installed by a user who did not have the permissions required to run it. Select Reauthorize in the Actions menu to reauthorize.
(too many 'reauthorize's! Any suggestions @szabosteve ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about This transform was installed by a user who did not have the permissions required to run it. Reauthorize it in the Actions menu.
?
In the case of the user without proper permissions, I propose to use the following: This transform was created with insufficient permissions. Contact your administrator to request the required permissions.
So we can use a single term instead of permissions
and privileges
.
(I don't use suggesting mode because it would be more confusing.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated here 1775dd0
(#154736)
color="warning" | ||
title={i18n.translate('xpack.transform.transformList.unauthorizedTransformsCallout', { | ||
defaultMessage: | ||
'{unauthorizedCnt, plural, one {A transform was installed but requires more permissions to run.} other {# transforms were installed but require more permissions to run.}} Contact your administrator to request the required privileges.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, this message should be adjusted if logging back in as a user with the correct permissions.
Nit - the text refers to both 'permissions' and 'privileges'. Should we use a single term here @szabosteve?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use the same string as above if the user has correct permissions: A transform was installed by a user who did not have the permissions required to run it. Reauthorize it in the Actions menu.
In the case of the user without proper permissions, I propose to use the following: This transform was created with insufficient permissions. Contact your administrator to request the required permissions.
So we can use a single term instead of permissions and privileges.
(I don't use suggesting mode because it would be more confusing.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated here 1775dd0
(#154736)
.../plugins/transform/public/app/sections/transform_management/transform_management_section.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latest text edits LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latest changes code LGTM.
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @qn895 |
Summary
Part of #151186. Follow up of #154665. This PR adds the ability to Reauthorize transforms with a secondary authorization so that it can start operating correctly.
If the transform was originally created with insufficient permission
It will show an option to



Reauthorize
transform for both individual and bulk:Reauthorizing transform will create an API key using the user's credential, call
transform/_update
with thees-secondary-authorization: 'ApiKey {encoded_api_key}
in the headers, and start the transform.If the transform was originally created with sufficient permission:
This PR also updates the behavior of the tooltip message when a bulk action should be disabled.

WIP:
Checklist
Delete any items that are not applicable to this PR.
Risk Matrix
Delete this section if it is not applicable to this PR.
Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.
When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:
For maintainers