-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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] creating objects using undefined
or primitives as attributes causes errors
#123575
Comments
Pinging @elastic/kibana-core (Team:Core) |
Shouldn't we consider it as a bug? IIRC #118969 always expected |
Given that we don't currently document anywhere that the But I agree that, in practice, all our SO types are using an object/record shape for their attributes, so it shouldn't be an API breaking change to add such validation and update our API documentation. In that case, we can consider this a bug. I'll go ahead and flag the issue accordingly. |
Creating saved objects using
SavedObjectClient.create
and/orSavedObjectClient.bulkCreate
does not perform any kind of basic surface validation of the shape of the provided attributes.Even if we're not enforcing that the provided attributes are an object, even within the
SavedObject
type,there are numerous parts of the code were we make this assumption by trying to access
obj.attributes.someStuff
.For example, by creating a dashboard with empty attributes, using
I could reproduce two errors in a few minutes,
one coming from the associated collector:
and one when accessing the SOM listing page
Per-type attributes validation was introduced in #118969, however, as it will take some time before teams starts defining their schemas, and as it's likely that it will not even be done for all our registered types, we may want to add some surface validation around the expected shape of the
attributes
of a saved object during its creation.We may also want to change our
SavedObject
type definition to reflect that the typeT
of the attributes must be an object.The text was updated successfully, but these errors were encountered: