-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Making type required for SavedObjectsClient.find #18924
Conversation
I don't know if I understand that... you mean no current use specifies type? or all current use specifies type? Edit: Oh, we're now requiring type, so none of them today do it already. |
I'm not 100% on the reasoning behind this. Is there an issue or discussion about it? |
Sorry, really poor wording... All usages of |
It's to enable this: https://github.com/elastic/kibana/pull/18645/files#diff-f75e9a376a3b5fbbb3c95b0c7e28a269R47 We need to perform an authorization check on the The other potential solution would be for us to know about all of the saved object types, determine which ones the user is authorized to "find" and then add a filter to the |
💔 Build Failed |
Jenkins, test this |
💚 Build Succeeded |
@archanid have you had a chance to put any more thought into this? @elastic/kibana-platform care to weight in? RBAC Phase 1 is contingent on this solution or the alternate discussed in the issue description. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for more explanation around this. LGTM
I'm fine with it and in general prefer to limit the options we expose to the ones we need, Since we aren't using cross-type |
I'm not opposed to making |
Completely agree, and once we're able to enumerate all of the saved object types (hopefully enabled by the new saved objects system) then enabling this becomes trivial. This is just the path of least resistance at the moment. |
Would it be possible to constrain the results another way? As Court mentioned, this will limit or complicate our ability to provide things like a universal search across all types. Since #17426 was merged, I also believe we are using find without a type since the listing includes mixed types? @chrisronline, can you confirm. |
#17426 added the ability to "find" multiple types, which we can support as well. I'm working on modifying this PR to support this approach as well. |
Spoke with @kobelb over Zoom. The SavedObjectClient is aware of the mapping, which you can use to get a list of all possible "types". This will allow us to get a filtered list of documents based on the allowed types. |
@tylersmalley Yea, I added support for fetch multiple types in a single request |
I look forward to catching up with the new changes to this PR and "re-approving." |
@tylersmalley was kind enough to point out that we have a way to enumerate the various types via the mappings, so we don't need to impose this limitation anymore. |
All usages of the
SavedObjectClient#find
currently specify the type, and the ability to secure#find
without specifying the type requires us to be able to enumerate all known saved object types which isn't currently available.This PR makes
type
required and throws an explicit error if it's used without specifying thetype
. There was potential for us to change the method signature of#find
and movetype
to be a separate parameter, making this requirement more obvious to consumers, but given the fact that we'd like to support this long term, this seemed like an unnecessary change.