-
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
[DISCUSS] Saved-objects find with aggregations #64137
Comments
/cc @elastic/kibana-platform |
Aggregations get filtered by the query so it is probably fairly safe. Plugins could almost certainly break the rules but that's always going to be the case. |
To add to what @kobelb said, we're also doing whitelist validation on the passed in aggregation to prevent any scripts from executing. |
In addition to what Nik said, you should disallow Related, parent/child and nested aggs may be a bit "dangerous" too. E.g. the query restricts the scope to matching documents, but a |
Correct, but good to be aware of. |
Thank you everyone for your feedback. I believe that we've come to the consensus that the approach we're intending to implement in Kibana will work, but there are certain aggregations which can't be supported, so care should be taken when adding a new aggregation type. |
All of Kibana's saved-objects are stored as Elasticsearch documents, and are used to represent Dashboards, Visualizations, etc. For example, the following Elasticsearch document represents a Visualization:
End-users of Kibana don't have access to all saved-objects, and they're commonly restricted to only access a subset of saved-object types in specific namespaces.
Kibana enforces this by requiring that end-users access saved-objects using a service which first performs an authorization check to ensure the user is authorized to access a subset of saved-objects before performing the query against Elasticsearch. There's a REST API which is a facade over the service itself, and our docs enumerate all of the functions that are currently provided: https://www.elastic.co/guide/en/kibana/current/saved-objects-api.html
For example, the following HTTP request to Kibana's saved-objects API:
will be translated into the following ES query:
There's a PR being reviewed, which expands upon the current functionality of the saved-objects find to allow consumers to now request aggregations.
For example, we want to allow the user to request a max aggregation using the following HTTP request to Kibana's saved-objects API:
which will be translated to the following ES query:
The
query
in the request body is necessary to restrict the user to only view the documents which they have access to. As long as thequery
is limiting the user to the proper subset of documents, are we safe to allow any arbitrary aggregations to be specified by the end-user?The text was updated successfully, but these errors were encountered: