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

[ML] [Transforms] prefer secondary auth headers for transforms #86757

Merged

Conversation

benwtrent
Copy link
Member

@benwtrent benwtrent commented May 12, 2022

When creating and updating transforms, it is possible for clients to provide secondary headers.

When PUT, _preview, _update is called with secondary authorization headers, those are then used or stored with the transform.

closes: #86731

@elasticmachine
Copy link
Collaborator

Pinging @elastic/ml-core (Team:ML)

@elasticsearchmachine
Copy link
Collaborator

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

Copy link
Contributor

@droberts195 droberts195 left a comment

Choose a reason for hiding this comment

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

This commit also fixes a bug with _start transform that didn't utilize the stored headers to create the destination index.

Shouldn't there be a change to TransportStartTransformAction.java for this part?

Have you got a commit locally that made that part of the change but isn't pushed to GitHub?

docs/changelog/86757.yaml Outdated Show resolved Hide resolved
@@ -24,6 +24,12 @@ Requires the following privileges:
* source indices: `read`, `view_index_metadata`
* destination index: `read`, `create_index`, `index`. If a `retention_policy` is configured, the `delete` privilege is
Copy link
Contributor

Choose a reason for hiding this comment

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

You could also modify the start transform docs page to remove the index permission requirements if they're no longer needed.

@benwtrent
Copy link
Member Author

Have you got a commit locally that made that part of the change but isn't pushed to GitHub?

The x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/persistence/TransformIndex.java contains the fix.

Its about the creating destination index as part of _start so the bug fix is indeed for start but not in that particular file :).

benwtrent and others added 2 commits May 12, 2022 14:58
Co-authored-by: David Roberts <dave.roberts@elastic.co>
@droberts195
Copy link
Contributor

The x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/persistence/TransformIndex.java contains the fix.

Ah, OK, thanks. It’s getting late for me today. I’ll have a proper look tomorrow.

Copy link
Contributor

@hendrikmuhs hendrikmuhs 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
Contributor

@droberts195 droberts195 left a comment

Choose a reason for hiding this comment

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

LGTM on the secondary credentials.

I think there's another problem in the code with permissions for start vs create. That could be fixed in a separate PR as it's really nothing to do with secondary credentials, which is the subject of this PR.

Changing how permissions work for transforms is a more noticeable change for end users than introducing the secondary credentials option (which is more of an internal technical detail). So ideally we'd have a release note that emphasises this point.

Given that the PR is mixing two things, please can you do one of the following (whichever is less effort):

  1. Move the permissions fix for the destination index permissions into a separate PR and also fix the permissions required on the source index by the start API in that PR
  2. Open a new PR to fix the permissions required on the source index by the start API but release note it as fixing both the permissions problems

Either way that means we'll have something in the release notes that alerts users to the change. I don't see how anybody can complain because we're making the distinction in permissions required for different operations clearer and no operation will require more permissions than it did before.

docs/reference/transform/apis/start-transform.asciidoc Outdated Show resolved Hide resolved
Copy link
Contributor

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :ml/Transform Transform Team:ML Meta label for the ML team v8.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ML] Prefer secondary authentication headers when creating/updating transforms
6 participants