-
Notifications
You must be signed in to change notification settings - Fork 25.4k
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
Conversation
x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/Security.java
Outdated
Show resolved
Hide resolved
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 |
Pinging @elastic/es-security (Team:Security) |
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.
Nice work, and solid test coverage!
A few suggestions but this is almost ready to ship.
x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/Security.java
Outdated
Show resolved
Hide resolved
x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/Security.java
Outdated
Show resolved
Hide resolved
x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/Security.java
Outdated
Show resolved
Hide resolved
x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/Security.java
Outdated
Show resolved
Hide resolved
x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/Security.java
Outdated
Show resolved
Hide resolved
x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/SecurityTests.java
Outdated
Show resolved
Hide resolved
x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/SecurityTests.java
Outdated
Show resolved
Hide resolved
...ti-cluster/src/javaRestTest/java/org/elasticsearch/xpack/remotecluster/CcsSlowLogRestIT.java
Outdated
Show resolved
Hide resolved
...ti-cluster/src/javaRestTest/java/org/elasticsearch/xpack/remotecluster/CcsSlowLogRestIT.java
Outdated
Show resolved
Hide resolved
...ti-cluster/src/javaRestTest/java/org/elasticsearch/xpack/remotecluster/CcsSlowLogRestIT.java
Outdated
Show resolved
Hide resolved
Clean up inline comments Co-authored-by: Nikolaj Volgushev <[email protected]>
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.
LGTM! Great work on the test coverage 👍
x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/SecurityTests.java
Outdated
Show resolved
Hide resolved
…king * upstream/main: (90 commits) Register a blob cache long counter metric for total evicted regions (elastic#131862) Move plan attribute resolution to its own component (elastic#131830) Make restore support multi-project (elastic#131661) Use logically more correct expression (elastic#131869) [ES|QL] Change equals and hashcode for ConstantNullBlock (elastic#131817) Update `TransportVersion` to support a new model (elastic#131488) Correct slow log user for RCS 2.0 (elastic#130140) Revert "Remove 8.17 from dev branches" Mute org.elasticsearch.compute.aggregation.ValuesBytesRefGroupingAggregatorFunctionTests testSomeFiltered elastic#131878 Remove 8.17 from dev branches Revert "CompressorFactory.compressor (elastic#131655)" (elastic#131866) Add fast path for single value in VALUES aggregator (elastic#130510) Resolve inference release tests failing due to missing feature flag (elastic#131841) [Docs] Replace placeholder URLs (elastic#131309) CompressorFactory.compressor (elastic#131655) add availability info for speed loading setting (elastic#131714) [Logstash] Move `elastic_integration` plugin usage to ES logstash-bridge. (elastic#131486) Migrate x-pack-enrich legacy rest tests to new test framework (elastic#131743) Fix plugin example test failures due to deprecation warning (elastic#131819) Remove deprecated function isNotNullAndFoldable (elastic#130944) ...
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, 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 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.See comments for discussion on integration tests(resolved)Ticket
Original issue is ES-8568 on Jira.