elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.68k stars 8.23k forks source link

Handle decryption in saved object find with partial fields #200049

Open jeramysoucy opened 2 weeks ago

jeramysoucy commented 2 weeks ago

Related: https://github.com/elastic/kibana/pull/198703

Description

The saved object repository's find function allows partial objects to be retrieved via the SavedObjectsFindOptions.fields parameter. When this occurs, the partial documents do not undergo migration, however, decryption is still attempted on any attributes with dangerouslyExposeValue set to true.

Decryption will fail if:

Note: The find function handles decryption failures gracefully, however, an error log is generated for every decryption failure that occurs. Our serverless dashboards and alerts will pick up this failure without knowing the context.

This case may never occur, but because it is possible, it should be handled appropriately.

Potential solution

One solution would be to first determine if the find parameters target dangerously exposed encrypted attributes, and if it does, augment the fields parameter value with the required AAD fields in order to perform decryption successfully. The additional fields could be stripped from the objects before returning the response.

elasticmachine commented 2 weeks ago

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