-
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
Can not share multiple saved queries that use the same data view #168049
Comments
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
cc @elastic/kibana-security |
I don't think @elastic/kibana-data-discovery can fix this, so it should be labeled with |
We (@elastic/kibana-security) triaged this today:
@jeramysoucy will be prioritizing a fix for this. We do not yet know the level of effort involved in the fix, but he will keep this issue updated as he learns more. |
I have opened this PR to resolve the issue. In working on this issue, I noticed that the behavior of un-sharing saved objects from spaces may not be ideal (this was also reported by @teresaalvarezsoler). In the example of this issue, if one of the saved queries is un-shared from the second space, the data view is also unshared even though it is still referenced by the other saved query in that space. I opened a separate issue to track this. |
Closes #168049 ## Summary This PR adjusts the KQL filters when collecting references to saved objects for the purpose of updating their spaces (i.e. sharing saved objects to spaces). An additional filter is added to specifically exclude ID -> ID matches - an ID match would mean the object has already been shared to the destination space and there is no conflict. Filters to match the shared object's ID or origin ID to the destination space's objects' origin ID, and to match the shared object's origin ID to the destination space's objects' IDs remain in place to properly check for conflicts with potential copies. ### Manual Testing - Create 2 spaces: A and B - Add a sample data set (e.g. flight) to space A - In Discover, create a saved query called "s1" with a filter pill that uses the sample data logs data view - Create another saved query called "s2" with a filter pill that uses the sample data logs data view - Go to `Stack Management->Saved` Objects and share the "s1" query to space B - Now share the "s2" query to space B. From the main branch you will see that there is a conflict that disallows sharing the second query. This is because it is also attempting to share the referenced data view, which is already in space B. However, this should not be a conflict - from this PR you will be able to successfully share both queries. ### Automated Testing - packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/utils/find_shared_origin_objects.test.ts - packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/internals/collect_multi_namespace_references.test.ts - x-pack/test/spaces_api_integration/common/suites/get_shareable_references.ts --------- Co-authored-by: kibanamachine <[email protected]>
Closes elastic#168049 ## Summary This PR adjusts the KQL filters when collecting references to saved objects for the purpose of updating their spaces (i.e. sharing saved objects to spaces). An additional filter is added to specifically exclude ID -> ID matches - an ID match would mean the object has already been shared to the destination space and there is no conflict. Filters to match the shared object's ID or origin ID to the destination space's objects' origin ID, and to match the shared object's origin ID to the destination space's objects' IDs remain in place to properly check for conflicts with potential copies. ### Manual Testing - Create 2 spaces: A and B - Add a sample data set (e.g. flight) to space A - In Discover, create a saved query called "s1" with a filter pill that uses the sample data logs data view - Create another saved query called "s2" with a filter pill that uses the sample data logs data view - Go to `Stack Management->Saved` Objects and share the "s1" query to space B - Now share the "s2" query to space B. From the main branch you will see that there is a conflict that disallows sharing the second query. This is because it is also attempting to share the referenced data view, which is already in space B. However, this should not be a conflict - from this PR you will be able to successfully share both queries. ### Automated Testing - packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/utils/find_shared_origin_objects.test.ts - packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/internals/collect_multi_namespace_references.test.ts - x-pack/test/spaces_api_integration/common/suites/get_shareable_references.ts --------- Co-authored-by: kibanamachine <[email protected]> (cherry picked from commit 460f5e3)
…9000) # Backport This will backport the following commits from `main` to `8.11`: - [Fixes conflict checks for sharing saved objects (#168655)](#168655) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Jeramy Soucy","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-10-16T16:18:19Z","message":"Fixes conflict checks for sharing saved objects (#168655)\n\nCloses #168049\r\n\r\n## Summary\r\n\r\nThis PR adjusts the KQL filters when collecting references to saved\r\nobjects for the purpose of updating their spaces (i.e. sharing saved\r\nobjects to spaces). An additional filter is added to specifically\r\nexclude ID -> ID matches - an ID match would mean the object has already\r\nbeen shared to the destination space and there is no conflict. Filters\r\nto match the shared object's ID or origin ID to the destination space's\r\nobjects' origin ID, and to match the shared object's origin ID to the\r\ndestination space's objects' IDs remain in place to properly check for\r\nconflicts with potential copies.\r\n\r\n### Manual Testing\r\n- Create 2 spaces: A and B\r\n- Add a sample data set (e.g. flight) to space A\r\n- In Discover, create a saved query called \"s1\" with a filter pill that\r\nuses the sample data logs data view\r\n- Create another saved query called \"s2\" with a filter pill that uses\r\nthe sample data logs data view\r\n- Go to `Stack Management->Saved` Objects and share the \"s1\" query to\r\nspace B\r\n- Now share the \"s2\" query to space B. From the main branch you will see\r\nthat there is a conflict that disallows sharing the second query. This\r\nis because it is also attempting to share the referenced data view,\r\nwhich is already in space B. However, this should not be a conflict -\r\nfrom this PR you will be able to successfully share both queries.\r\n\r\n### Automated Testing\r\n-\r\npackages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/utils/find_shared_origin_objects.test.ts\r\n-\r\npackages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/internals/collect_multi_namespace_references.test.ts\r\n-\r\nx-pack/test/spaces_api_integration/common/suites/get_shareable_references.ts\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"460f5e333631500b2d7984c212ab4d15f5ca4d8e","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Security","release_note:skip","backport:prev-minor","v8.11.0","v8.12.0"],"number":168655,"url":"https://github.com/elastic/kibana/pull/168655","mergeCommit":{"message":"Fixes conflict checks for sharing saved objects (#168655)\n\nCloses #168049\r\n\r\n## Summary\r\n\r\nThis PR adjusts the KQL filters when collecting references to saved\r\nobjects for the purpose of updating their spaces (i.e. sharing saved\r\nobjects to spaces). An additional filter is added to specifically\r\nexclude ID -> ID matches - an ID match would mean the object has already\r\nbeen shared to the destination space and there is no conflict. Filters\r\nto match the shared object's ID or origin ID to the destination space's\r\nobjects' origin ID, and to match the shared object's origin ID to the\r\ndestination space's objects' IDs remain in place to properly check for\r\nconflicts with potential copies.\r\n\r\n### Manual Testing\r\n- Create 2 spaces: A and B\r\n- Add a sample data set (e.g. flight) to space A\r\n- In Discover, create a saved query called \"s1\" with a filter pill that\r\nuses the sample data logs data view\r\n- Create another saved query called \"s2\" with a filter pill that uses\r\nthe sample data logs data view\r\n- Go to `Stack Management->Saved` Objects and share the \"s1\" query to\r\nspace B\r\n- Now share the \"s2\" query to space B. From the main branch you will see\r\nthat there is a conflict that disallows sharing the second query. This\r\nis because it is also attempting to share the referenced data view,\r\nwhich is already in space B. However, this should not be a conflict -\r\nfrom this PR you will be able to successfully share both queries.\r\n\r\n### Automated Testing\r\n-\r\npackages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/utils/find_shared_origin_objects.test.ts\r\n-\r\npackages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/internals/collect_multi_namespace_references.test.ts\r\n-\r\nx-pack/test/spaces_api_integration/common/suites/get_shareable_references.ts\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"460f5e333631500b2d7984c212ab4d15f5ca4d8e"}},"sourceBranch":"main","suggestedTargetBranches":["8.11"],"targetPullRequestStates":[{"branch":"8.11","label":"v8.11.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/168655","number":168655,"mergeCommit":{"message":"Fixes conflict checks for sharing saved objects (#168655)\n\nCloses #168049\r\n\r\n## Summary\r\n\r\nThis PR adjusts the KQL filters when collecting references to saved\r\nobjects for the purpose of updating their spaces (i.e. sharing saved\r\nobjects to spaces). An additional filter is added to specifically\r\nexclude ID -> ID matches - an ID match would mean the object has already\r\nbeen shared to the destination space and there is no conflict. Filters\r\nto match the shared object's ID or origin ID to the destination space's\r\nobjects' origin ID, and to match the shared object's origin ID to the\r\ndestination space's objects' IDs remain in place to properly check for\r\nconflicts with potential copies.\r\n\r\n### Manual Testing\r\n- Create 2 spaces: A and B\r\n- Add a sample data set (e.g. flight) to space A\r\n- In Discover, create a saved query called \"s1\" with a filter pill that\r\nuses the sample data logs data view\r\n- Create another saved query called \"s2\" with a filter pill that uses\r\nthe sample data logs data view\r\n- Go to `Stack Management->Saved` Objects and share the \"s1\" query to\r\nspace B\r\n- Now share the \"s2\" query to space B. From the main branch you will see\r\nthat there is a conflict that disallows sharing the second query. This\r\nis because it is also attempting to share the referenced data view,\r\nwhich is already in space B. However, this should not be a conflict -\r\nfrom this PR you will be able to successfully share both queries.\r\n\r\n### Automated Testing\r\n-\r\npackages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/utils/find_shared_origin_objects.test.ts\r\n-\r\npackages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/internals/collect_multi_namespace_references.test.ts\r\n-\r\nx-pack/test/spaces_api_integration/common/suites/get_shareable_references.ts\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"460f5e333631500b2d7984c212ab4d15f5ca4d8e"}}]}] BACKPORT--> Co-authored-by: Jeramy Soucy <[email protected]>
Closes elastic#168049 ## Summary This PR adjusts the KQL filters when collecting references to saved objects for the purpose of updating their spaces (i.e. sharing saved objects to spaces). An additional filter is added to specifically exclude ID -> ID matches - an ID match would mean the object has already been shared to the destination space and there is no conflict. Filters to match the shared object's ID or origin ID to the destination space's objects' origin ID, and to match the shared object's origin ID to the destination space's objects' IDs remain in place to properly check for conflicts with potential copies. ### Manual Testing - Create 2 spaces: A and B - Add a sample data set (e.g. flight) to space A - In Discover, create a saved query called "s1" with a filter pill that uses the sample data logs data view - Create another saved query called "s2" with a filter pill that uses the sample data logs data view - Go to `Stack Management->Saved` Objects and share the "s1" query to space B - Now share the "s2" query to space B. From the main branch you will see that there is a conflict that disallows sharing the second query. This is because it is also attempting to share the referenced data view, which is already in space B. However, this should not be a conflict - from this PR you will be able to successfully share both queries. ### Automated Testing - packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/utils/find_shared_origin_objects.test.ts - packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/internals/collect_multi_namespace_references.test.ts - x-pack/test/spaces_api_integration/common/suites/get_shareable_references.ts --------- Co-authored-by: kibanamachine <[email protected]>
Kibana version:
8.11.0, main
Describe the bug:
It is not possible to share multiple saved queries that use the same data view to a different space. When sharing the second saved query, the related data view is compared to the data views already in the space. Since the data view already exists in the space the UI blocks sharing the saved query.
Steps to reproduce:
Screenshots (if relevant):
shareable-objects-bug.mp4
Any additional context:
Unfortunately, I think this issue is blocking this feature. Until that issue is resolved, I believe any saved objects that use references like data views will be similarly blocked.
The text was updated successfully, but these errors were encountered: