-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Add new audit handler method for action responses #63708
Merged
albertzaharovits
merged 38 commits into
elastic:master
from
albertzaharovits:post_authz_audit_event
Dec 17, 2020
Merged
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
c710726
Remove redundant IOException
albertzaharovits e9f2866
Merge branch 'master' into post_authz_audit_event
albertzaharovits 48d647e
WIP
albertzaharovits e3c5c3f
Merge branch 'master' into post_authz_audit_event
albertzaharovits 9469127
SecurityActionFilterTests
albertzaharovits 2f5e546
Strict!
albertzaharovits d88969b
Merge branch 'master' into post_authz_audit_event
albertzaharovits 0ebadb9
Trash test
albertzaharovits f6ff433
SecurityActionFilter
albertzaharovits 9f56238
extract requestId and authentication before running the action
albertzaharovits 765493f
remove thrash
albertzaharovits cf172b8
Merge branch 'master' into post_authz_audit_event
albertzaharovits 71790f9
Security enabled guard in SecurityServerTransport
albertzaharovits e25903e
AuthenticationServiceTests
albertzaharovits 6e229a8
AuthorizationServiceTests
albertzaharovits 43f3644
ServerTransportFilterTests
albertzaharovits a922aa8
SecurityActionFilterTests
albertzaharovits aada0ae
Merge branch 'master' into post_authz_audit_event
albertzaharovits 655bba9
More tests
albertzaharovits 8c03167
Checkstyle
albertzaharovits b514c0c
Merge branch 'master' into post_authz_audit_event
albertzaharovits 6706993
Reuse the `User#isInternal` method in the authorization service
albertzaharovits ec22611
Merge branch 'master' into post_authz_audit_event
albertzaharovits 1b5b65e
tests afte merge conflict
albertzaharovits e7383c5
wrong merge choice
albertzaharovits 14425d5
Good merge choice
albertzaharovits a730658
Move chain.proceed down
albertzaharovits c6d1a74
Remove line
albertzaharovits 93299a3
Merge branch 'master' into post_authz_audit_event
albertzaharovits 3926ada
Checkstyle
albertzaharovits 4d579d7
Merge branch 'master' into post_authz_audit_event
albertzaharovits e5ddb6e
Only intercept the action filter
albertzaharovits cf59a60
Checkstyle test
albertzaharovits 7851883
Merge branch 'master' into post_authz_audit_event
albertzaharovits 3753771
Merge branch 'master' into post_authz_audit_event
albertzaharovits 49a2852
Nits
albertzaharovits 6e2e882
Update x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/s…
albertzaharovits b81f644
Merge branch 'master' into post_authz_audit_event
elasticmachine 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
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
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
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
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
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
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
Oops, something went wrong.
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 is not technically true, some actions' (
TransportMasterNodeAction
) responses are intercepted on the coordinating node, as well as on the master node.The naming and descriptions are difficult to write to convey the subset of actions that are covered.
We could also bleed some internals in here and mention the
SecurityActionFilter
.Open to suggestions.
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 think we could keep the previous name, i.e.
actionResponse
. Please let me explain: When I suggested pulling out the code fromSecurityServerTransportInterceptor
, it was in the context of getting auditing for API key ID in for v7.11.0. The reasons are:SecurityServerTransportInterceptor
is a fairly low level indexing response and does not really provide extra valuable information than the one in the coordinating node. Therefore auditing on just the coordinating node is sufficient.TransportReplicationAction
. UnlikeTransportMasterNodeAction
, it does not go through theSecurityActionFilter
(on the remote node). This means: on the remote node, we will not get another auditing entry fromSecurityActionFilter
, i.e. there will only be a single auditing entry about API key creation and it is on the coordinating node.So my motivation was rather narrowly focused on the particular use case. The agreement, as I understand it, is to defer the auditing code in
SecurityServerTransportInterceptor
until the next release. Because it is not necessary for API key auditing in this release and if it is not in use, it's better to be left out. But we also agreed that it could still be useful when we expand the usage scenario and this is subject to further discussion.IIUC, your intention of changing the method name is for the possibility to have two different audit event types. I should have been clear that it was not my proposal. I consider whether auditing inside
SecurityServerTransportInterceptor
an implementation detail, which we chose to opt out for initial release, but could choose to add it later as an enhancement. For verbosity and duplication control, I'd prefer to solve it in a different way other than splitting it into different audit event types. I hope this makes sense.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 the detailed explanation Yang, but I would like to focus the conversation on the scope of this PR only. We should consider the broader picture, as you describe, but ultimately this PR is what gets merged as a unit, and what we merge in the future is subject to debate still.
If we merge this PR, which adds the audit hook for the responses of actions intercepted by the
SecurityActionFilter
only, we add to the interface of theLoggingAuditTrail
.When we later merge the code to allow intercepting the responses of the other actions, we have the options to:
LoggingAuditTrail
hook method(or any mix of them, really, if we feel wild)
Because this is a private interface, I don't believe we have to name it in anticipation of its use. We should name it for the purpose that it serves right now, as we can always tinker with it later. For this reason, I would not favor the
actionResponse
name.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.
Just trying to brainstorm here: How about calling this one
actionResponse
and the other onetransportResponse
?As you said, this is a private interface, so we don't have to struggle too much with its name now. So please feel free to use whatever works for you.
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.
Yeah, this could work. I'll keep this in mind when we'll iterate on the interface.