[SavedObjects] creating objects using undefined
or primitives as attributes causes errors
#123575
Labels
bug
Fixes for quality problems that affect the customer experience
Feature:Saved Objects
Team:Core
Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
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: