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

Importing objects can result in broken references for share-capable objects #120312

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

Importing objects can result in broken references for share-capable objects #120312

jportner opened this issue Dec 3, 2021 · 1 comment · Fixed by #121046
Assignees
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 3, 2021

Kibana version: 8.0+ (unreleased)

Describe the bug:

This is a bug that exists due to an oversight in #75444.

In 7.16, most saved objects are "isolated" to a single space and their IDs are only guaranteed to be unique within one space.
Starting in 8.0, many object types are being converted to become share-capable, and object IDs must be globally unique; as a result, objects in custom spaces will have their IDs regenerated (#100489).

During the import process, we added code that will check the origins of each object to be imported, and change them to match the object IDs with matching origins in the same space.
This preserves the old "pseudo-copy" behavior of being able to make at most one copy of an object in a given space. (You need to overwrite the existing object(s)).

If you import an object and all of its references, we check origins for each one, then change the references to match, then try to create/overwrite any existing objects.
In essence, we explicitly check the origin of each object, and we implicitly check the origin of references.

However, we support exporting objects without references, which means we really need to explicitly check the origin of references too in those cases.

Steps to reproduce:

I've produced a test Dashboard that has a reference to a single test Markdown Visualization.
test-exports.zip
This file includes two exports:

  • export-dashboard-with-references.ndjson
  • export-only-dashboard.ndjson
  1. Use Kibana 8.0+
  2. Navigate to Space Management, then create a new space "Second", do not go to it
  3. Navigate to Saved Objects Management, import the export-dashboard-with-references.ndjson file - this will create the dashboard and the visualization
  4. Pick the dashboard, copy it to the custom space (this always includes references), make sure to select "Check for existing objects" (this preserves the origin)
  5. Go to the Second space, navigate to Saved Objects Management, then view relationships for the dashboard - the reference should be intact
  6. Import the export-only-dashboard.ndjson file - this will overwrite the dashboard
  7. View relationships for the dashboard again - the reference should be broken

Expected behavior:

You should be able to import an object without references and maintain those references based on their origins.

Any additional context:

There is a follow-on enhancement we should implement sometime in early 8.x: #120313

@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 3, 2021
@jportner jportner self-assigned this Dec 3, 2021
@elasticmachine
Copy link
Contributor

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

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