-
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
[Serverless][Security Solution][Endpoint] Remove use of hooks to check access to.lists-*
for endpoint exceptions access
#171412
Merged
ashokaditya
merged 15 commits into
elastic:main
from
ashokaditya:fix/dw-endpoint-exceptions-index-permissions-check-169268
Nov 22, 2023
Merged
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
6344e93
use useListPrivileges to check access to `.lists-*` index
ashokaditya 9a079cf
use write/read index privilege checks instead
ashokaditya 4f4b65b
Merge branch 'main' into fix/dw-endpoint-exceptions-index-permissions…
ashokaditya 2c02033
update logic to not use negation
ashokaditya fe9ee12
Merge branch 'main' into fix/dw-endpoint-exceptions-index-permissions…
ashokaditya f89170b
Merge branch 'main' into fix/dw-endpoint-exceptions-index-permissions…
ashokaditya 394b1f0
remove need to check `.lists-*` privileges
ashokaditya 6075930
Merge branch 'main' into fix/dw-endpoint-exceptions-index-permissions…
kibanamachine 652a39d
Merge branch 'main' into fix/dw-endpoint-exceptions-index-permissions…
ashokaditya 21abb7a
Merge branch 'main' into fix/dw-endpoint-exceptions-index-permissions…
ashokaditya da91adb
Merge branch 'main' into fix/dw-endpoint-exceptions-index-permissions…
ashokaditya 31a94f7
Merge branch 'main' into fix/dw-endpoint-exceptions-index-permissions…
ashokaditya 1938e6b
Merge branch 'main' into fix/dw-endpoint-exceptions-index-permissions…
ashokaditya 82e3236
test for number of calls to `api/lists/index`
ashokaditya c025f9e
update test
ashokaditya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This looks like it was a partial copy/paste from
useListsConfig
, e.g.needsConfiguration
had a more comprehensive definition originally, and as such isn't quite correct here. But that logic was also specific to creating the lists index, and I think you could eliminate it entirely here (it doesn't matter whether they could create the index, we're not trying to do that here):However, I had a question about the definition of
hasListsAccess
, since the above shows more clearly that this is centered around thecanManageIndex
privilege: If this capability requires reading/writing lists data, thencanReadIndex
andcanWriteIndex
fromuseListsPrivileges
are what you want, here:manage
has no relation to that concept.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 looking into this @rylnd. I do think using
canReadIndex
andcanWriteIndex
makes more sense than the manage privilege. I'll make that change.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.
9a079cf
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.
and 2c02033
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.
@rylnd @kqualters-elastic @yctercero I'm now wondering if there's a way to verify index privileges on the server side for API requests. I'm testing with a role that has
read
access to.lists-*
index and also hasendpoint_exceptions_all
kibana privilege, such aswhich does restrict the role from doing any CUD operations on the UX as expected.
However, on the API side the role is able to do CUD operations, since endpoints exceptions are added to saved objects and now I'm wondering if we need index access for it at all? Or is there a way to restrict saved objects access using index privileges?
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.
@ashokaditya I think there's a lot of context here that I'm missing. Is there a ticket describing the behavior that you're trying to achieve here? Is this a bugfix that's triggered a permissions discussion?
Broadly, though: we typically are not proactive with ES permissions checking on the server, and instead attempt to perform the requested action as the user requesting it. If an error is raised within ES, we will surface that as part of the response.
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 again for looking into this @rylnd . Apologies for not providing context. The idea is to restrict
endpoint exceptions
for serverless users. Sepecifically when a user doesn't have anyendpoint
PLI (essentials/complete) they should not be able to accessendpoint exceptions
. Here is the first PR that introduced this check.After talking to my team, looks like we don't need the index privilege check at all, much like we don't for other endpoint artefacts (trusted apps, event filters etc.). We drive this purely via kibana privileges. So in the end, we don't need to use the
useListsPrivileges
for checking permissions to.lists-*
indices.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.
@paul-tavares @dasansol92 @semd ☝🏼
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.
@kqualters-elastic @yctercero looks like we might need to look into this a bit more. "Endpoint exceptions" is not similar to endpoint artefacts and so I'm not so sure if access to it should be similar to endpoint artefacts. I'm going to try and find a time so we can quickly discuss this offline.
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.
I spoke with @vitaliidm offline and looks like endpoint exceptions do not need
.lists-*
permissions.