Correct slow log user for RCS 2.0#130140
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) |
n1v0lg
left a comment
There was a problem hiding this comment.
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
Show resolved
Hide resolved
Clean up inline comments Co-authored-by: Nikolaj Volgushev <n1v0lg@users.noreply.github.com>
n1v0lg
left a comment
There was a problem hiding this comment.
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(theAuthenticationobject representing the user on the querying cluster) when processing cross-cluster access requests.user.effective.*fields if the original user was performing arun-asoperation on the querying cluster.apikey.idandapikey.nameif the original user authenticated via an API key on the querying cluster.Testing:
getAuthContextForSlowLog()inSecurityTeststo 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.