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

SavedObjects: Add migration script to ensure no empty IDs #146346

Closed
afharo opened this issue Nov 25, 2022 · 5 comments
Closed

SavedObjects: Add migration script to ensure no empty IDs #146346

afharo opened this issue Nov 25, 2022 · 5 comments
Labels
bug Fixes for quality problems that affect the customer experience Feature:Migrations Feature:Saved Objects Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc

Comments

@afharo
Copy link
Member

afharo commented Nov 25, 2022

Related to #146345 and #120693.

#120693 added a validation so Saved Objects cannot be created without an ID. However, when upgrading from previous versions, we may keep those IDs empty. This may eventually break when exporting and importing the SOs.

We should create a migration script to ensure all migrated documents have an ID.

N.B.: Mind the references from other SOs.

@afharo afharo added bug Fixes for quality problems that affect the customer experience Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Feature:Saved Objects Feature:Migrations labels Nov 25, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@pgayvallet
Copy link
Contributor

We should create a migration script to ensure all migrated documents have an ID.

Just my 2cts, but global migrations and coreMigrationVersion were ihmo a terrible mistake only currently used for shareable-SO types ID rewrites.

Unless we think the risk of such ID-less document for our system is very high (e.g if such documents can be created by internal features and not only by external calls to our APIs and/or tampering with export files), I would restrain from implementing such 'core' migration.

@afharo
Copy link
Member Author

afharo commented Nov 29, 2022

I agree that manually tampered documents should not be of our concerns (especially since there are already measures to ensure they are not created in recent versions).

However, somehow, we managed to break Kibana by importing documents with empty IDs (#146345). Probably fixing that issue I linked is just enough for now.

@TinaHeiligers
Copy link
Contributor

... empty IDs (#146345). Probably fixing that issue I linked is just enough for now.

Sounds to me like extending validation on objects being imported/created might work. An extension of #118969? Then again, I haven't seen any other issues with import/export docs with empty ID's yet.

@afharo
Copy link
Member Author

afharo commented Dec 1, 2022

I think we all agree that fixing #146345 might just be enough. I'll go ahead and close this issue. Feel free to reopen it if there's something I missed.

@afharo afharo closed this as completed Dec 1, 2022
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:Migrations Feature:Saved Objects Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
Projects
None yet
Development

No branches or pull requests

4 participants