Add audit logging for stream content#130594
Conversation
|
Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination) |
|
Hi @mhl-b, I've created a changelog YAML for you. |
ywangd
left a comment
There was a problem hiding this comment.
LGTM
I left a somewhat important comment and appreciate if you could address it. Additionally, could you please remove the following code and maybe replace it by an assertion that the request is no longer streaming.
| public boolean includeRequestBody() { | ||
| return includeRequestBody; | ||
| } |
There was a problem hiding this comment.
This seems problematic. According to this comment, the non-volatile field includeRequestBody is guaranteed to see the latest change because it is always read after the volatile field events. It is true within LoggingAuditTrail but no longer the case if we just return it here. I think we can either also read events field here before return or having SecurityRestFilter register its own settings update consumer for the INCLUDE_REQUEST_BODY setting so that it does not need to ask LoggingAuditTrail.
There was a problem hiding this comment.
SecurityRestFilter needs to know both features : LoggingAuditTrail and includeRequestBody are enabled. Shouldnt be much of a difference. Kind of hacky, cutting through two layers of abstraction.
There was a problem hiding this comment.
So a read for events before returnning should suffice in this case. Otherwise we may see stale value for includeRequestBody
There was a problem hiding this comment.
Making includeRequestBody volatile should be cleaner then, if I still need to read a volatile field. 9351f93
…rch into aggregating-audit-trail
| if (get() instanceof LoggingAuditTrail trail) { | ||
| return trail.includeRequestBody(); | ||
| } else { | ||
| return false; | ||
| } |
There was a problem hiding this comment.
one-liner?
| if (get() instanceof LoggingAuditTrail trail) { | |
| return trail.includeRequestBody(); | |
| } else { | |
| return false; | |
| } | |
| return get() instanceof LoggingAuditTrail trail && trail.includeRequestBody(); |
Add support for HTTP content audit logging for streamed content. After #129302 we can aggregate streamed content within REST layer. When
INCLUDE_REQUEST_BODYsetting is specified every streamed request will be aggregated in SecurityRestFilter. This flag is effectively disable streaming support.