Skip to content

Commit 8f64184

Browse files
Sanitize additional client authentication header (#130891)
Removing additional `X-Client-Authentication` header from thread context after it's been used.
1 parent 5323776 commit 8f64184

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

server/src/main/java/org/elasticsearch/common/util/concurrent/ThreadContext.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,7 @@ public void sanitizeHeaders() {
737737
entry -> entry.getKey().equalsIgnoreCase("authorization")
738738
|| entry.getKey().equalsIgnoreCase("es-secondary-authorization")
739739
|| entry.getKey().equalsIgnoreCase("ES-Client-Authentication")
740+
|| entry.getKey().equalsIgnoreCase("X-Client-Authentication")
740741
);
741742

742743
final ThreadContextStruct newContext = new ThreadContextStruct(

server/src/test/java/org/elasticsearch/common/util/concurrent/ThreadContextTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,8 @@ public void testSanitizeHeaders() {
11041104
final String authorizationHeader = randomCase("authorization");
11051105
final String authorizationHeader2 = randomCase("es-secondary-authorization");
11061106
final String authorizationHeader3 = randomCase("ES-Client-Authentication");
1107-
Set<String> possibleHeaders = Set.of(authorizationHeader, authorizationHeader2, authorizationHeader3);
1107+
final String authorizationHeader4 = randomCase("X-Client-Authentication");
1108+
Set<String> possibleHeaders = Set.of(authorizationHeader, authorizationHeader2, authorizationHeader3, authorizationHeader4);
11081109
Set<String> headers = randomizeHeaders
11091110
? randomSet(0, possibleHeaders.size(), () -> randomFrom(possibleHeaders))
11101111
: possibleHeaders;

0 commit comments

Comments
 (0)