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

Import saved object does not prefer exact match when using overwrite=true #121038

Closed
jportner opened this issue Dec 10, 2021 · 1 comment · Fixed by #121046
Closed

Import saved object does not prefer exact match when using overwrite=true #121038

jportner opened this issue Dec 10, 2021 · 1 comment · Fixed by #121046
Labels
bug Fixes for quality problems that affect the customer experience Feature:Security/Sharing Saved Objects Platform Security - Sharing Saved Objects feature impact:needs-assessment Product and/or Engineering needs to evaluate the impact of the change. loe:small Small Level of Effort Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more!

Comments

@jportner
Copy link
Contributor

jportner commented Dec 10, 2021

When importing or copying a saved object, conflict destination checking occurs based on the object's origin.
An existing object could have a matching origin without having the same object id.
The object's origin is its originId by default, or if that field is undefined, it is the object's id.

When multiple conflict destinations are found, the "exact match" should always be preferred if possible. This is demonstrated in our internal design documentation:

image

However, I found this not to always be the case. There is a bug in the logic that only exists when the overwrite=true option is enabled, where if there are 2+ destinations, the "exact match" destination is completely ignored.

  • If there is one remaining destination ("inexact match"), that one will be overwritten instead.
  • If there are 2+ remaining destinations, the user is presented with an "ambiguous_conflict" error and forced to choose one of the other destinations.

I confirmed this using my Sharing Saved Objects test plugin. In the example below, all four of the "Army Man" objects share an origin. I exported one and attempted to import it again, and I was presented with an ambiguous conflict error:

image

Note: this bug was introduced in #58139, and it technically exists as early as 7.10. However, the only way to get Kibana into a state where multiple objects in the same space share an origin is to share one from a space to another space. The only shareable objects pre-8.0 are ML jobs, and those cannot be imported or copied. So this bug doesn't impact any users yet, but we should fix it for the 8.0 release.

Edit: it is not possible to encounter this bug while copying saved objects, because we don't allow an object to be copied to a space where it already exists. E.g., you can't run into an "exact match" conflict when copying an object. So this bug only affects import.

@jportner jportner added bug Fixes for quality problems that affect the customer experience Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! Feature:Security/Sharing Saved Objects Platform Security - Sharing Saved Objects feature labels Dec 10, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-security (Team:Security)

@jportner jportner changed the title Import/copy saved object does not prefer exact match when using overwrite=true Import saved object does not prefer exact match when using overwrite=true Dec 10, 2021
@exalate-issue-sync exalate-issue-sync bot added impact:needs-assessment Product and/or Engineering needs to evaluate the impact of the change. loe:small Small Level of Effort labels Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Security/Sharing Saved Objects Platform Security - Sharing Saved Objects feature impact:needs-assessment Product and/or Engineering needs to evaluate the impact of the change. loe:small Small Level of Effort Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants