-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Correct slow log user for RCS 2.0 #130140
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
base: main
Are you sure you want to change the base?
Conversation
* @param auth The Authentication object to extract details from. | ||
* @param authContext The map to populate with authentication details. | ||
*/ | ||
private void populateAuthContextMap(Authentication auth, Map<String, String> authContext) { |
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.
For Cross-Cluster Search (CCS) slow logs, I've implemented so that user.*
, auth.type
, user.effective.*
, and apikey.*
fields are all populated from the inner authentication object.
Is this the precise intended behavior? Or should some fields explicitly signal the 'cross-cluster' nature (e.g., user.realm
showing _es_cross_cluster_access
), potentially sacrificing original user context?
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.
good q! I think we want the inner user context here -- we might consider add more fields to point to the cross-cluster nature of the query but I don't think that's trivial with slow logs, off the top of my head.
going with what you have will also match the slow logs behavior of RCS 1.
Hi @gmjehovich, I've created a changelog YAML for you. |
Discussion on Integration tests: As I understand, Are there existing multi-cluster IT frameworks or standard practices within Elasticsearch that could accommodate a true E2E CCS test for this kind of logging behavior? |
@gmjehovich true! I think an integration test is a good idea. We have |
Description:
This PR addresses an issue where Elasticsearch slow logs, specifically on the fulfilling cluster during a Cross-Cluster Search (CCS) with RCS 2.0, incorrectly displayed the authentication details of the cross-cluster API key's creator instead of the original user who initiated the remote search.
Solution Overview:
Security.getAuthContextForSlowLog()
to accurately extract theoriginalAuthentication
(theAuthentication
object representing the user on the querying cluster) when processing cross-cluster access requests.user.effective.*
fields if the original user was performing arun-as
operation on the querying cluster.apikey.id
andapikey.name
if the original user authenticated via an API key on the querying cluster.Testing:
getAuthContextForSlowLog()
inSecurityTests
to cover various scenarios for both local and cross-cluster access.Ticket
Original issue is ES-8568 on Jira.