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

Allow encrypted saved object types to support predefined ids #42762

Closed
wants to merge 3 commits into from

Conversation

kobelb
Copy link
Contributor

@kobelb kobelb commented Aug 6, 2019

Task Manager would like to use predefined IDs with encrypted saved objects. We were previously insisting on generating the ID within the EncryptedSavedObjectsClientWrapper so that we could use a UUID v4. This restriction was put in place because generally some other saved object has a reference to an "encrypted saved object" and we wanted to reduce the likelihood of someone potentially being able to guess the reference ID and use it for a nefarious purpose. Instead of relaxing this constraint for all saved object types used with the encrypted saved objects plugin, this PR allows certain saved object types to opt-out of this protection.

Resolves: #42688

"Release Note: Consumers of the Encrypted Saved Objects plugin can register types which allow predefined IDs to be specified"

@kobelb kobelb requested a review from a team as a code owner August 6, 2019 19:23
@kobelb kobelb changed the title Allow encryped saved object types to support predefined ids Allow encrypted saved object types to support predefined ids Aug 6, 2019
@kobelb kobelb requested a review from azasypkin August 6, 2019 19:24
@kobelb kobelb added the Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! label Aug 6, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-security

@kobelb kobelb added release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. v8.0.0 v7.4.0 labels Aug 6, 2019
@kobelb
Copy link
Contributor Author

kobelb commented Aug 6, 2019

/cc @mikecote

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@azasypkin
Copy link
Member

ACK: will review today or the first thing tomorrow morning (likely).

Copy link
Member

@azasypkin azasypkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! Would you mind also adding a quick note about this new option to the plugin's README.md?

@@ -107,6 +108,15 @@ export class EncryptedSavedObjectsService {
return this.typeRegistrations.has(type);
}

public allowPredefinedID(type: string) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional nit: would you mind adding a brief JSDoc to this method. The name is clear enough, but the fact that this method always returns true for non-registered types may not be obvious without reading the method body.

);
// since IDs are part of the AAD used during encryption. Types can opt-out of this restriction,
// when necessary, but it's much safer for this wrapper to generate them.
if (!this.options.service.allowPredefinedID(type) && options.id) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: would you mind swapping options.id and this.options.service.allowPredefinedID(type) here and in bulkCreate so that there is a higher chance that JS engine can optimize code and doesn't call allowPredefinedID() when options.id isn't specified?

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@kobelb kobelb added the stalled label Aug 13, 2019
@kobelb
Copy link
Contributor Author

kobelb commented Aug 13, 2019

We don't need this at the moment, but I don't want to get rid of this PR quite yet. Feel free to just ignore it for the time being.

@nchaulet
Copy link
Member

@kobelb We are getting a similar issue in Fleet where we want to encrypt saved object with predefined ids, is there any plans to move forward with this PR?

@kobelb
Copy link
Contributor Author

kobelb commented Jan 27, 2020

@nchaulet, if it's a requirement for Fleet we can resurrect this PR. Alerting ended up not needing it, so we abandoned it. Is there code or technical specs for what Fleet is doing here? Allowing predefined IDs could potentially be a security issue based on how they're consumed and used.

@nchaulet
Copy link
Member

nchaulet commented Jan 27, 2020

@kobelb no there is no issue, (I should add doc about that) but trying to resume:
During fleet setup we create a default configuration, a default enrollement api Key, and the default output (local ES cluster) all of this are saved object with an id of default, this is not working if we encrypt saved object, we could keep generated id and use another field to find these defaults saved objects but it makes thing harder for us.

@thomheymann
Copy link
Contributor

Going to resurrect this PR as it's required for audit logging of alerts/actions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. stalled Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Encrypted saved objects plugin to allow specifying a custom id on create
5 participants