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

[Runtime field editor] Fix preview error when not enough privileges #115070

Conversation

sebelga
Copy link
Contributor

@sebelga sebelga commented Oct 14, 2021

There is a current limitation in the ES Painless _execute API that requires too many privileges (cluster privileges [manage,all]). This is a problem when previewing a runtime field script.

This PR brings a temporary fix to this problem by not using the _execute API but the _search API.

How to test

  • Create a new role with only the read and view_index_metadata privilege on one of the indices
  • Assign a new user to that role and log into Kibana with that user
  • Navigate to the index pattern management app, select your index pattern and create a new field
  • Write a simple script (e.g. emit('hello');). --> You should see the preview of the script in the panel.
  • Change the script with emit(123); --> you should get a casting error

Fixes #114034
Fixes #114036
Fixes https://github.com/elastic/infra/issues/31927

@sebelga sebelga marked this pull request as ready for review October 15, 2021 12:51
@sebelga sebelga requested a review from a team as a code owner October 15, 2021 12:51
@sebelga sebelga requested a review from mattkime October 15, 2021 12:52
@sebelga sebelga added Project:RuntimeFields Team:AppServicesSv Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.16.0 v8.0.0 labels Oct 15, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-stack-management (Team:Stack Management)

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
indexPatternFieldEditor 151.5KB 151.5KB +13.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
indexPatternFieldEditor 19.0KB 19.0KB +26.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@sebelga sebelga added the release_note:skip Skip the PR/issue when compiling release notes label Oct 15, 2021
Copy link
Contributor

@mattkime mattkime left a comment

Choose a reason for hiding this comment

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

code looks good and works well!

@sebelga
Copy link
Contributor Author

sebelga commented Oct 15, 2021

Thanks for the review @mattkime !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Project:RuntimeFields release_note:skip Skip the PR/issue when compiling release notes Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.16.0 v8.0.0
Projects
None yet
4 participants