-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Preserve request headers in a mixed version cluster #79412
Merged
ywangd
merged 4 commits into
elastic:master
from
ywangd:es-79354-rewrite-security-headers
Oct 19, 2021
Merged
Changes from 3 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
x-pack/qa/rolling-upgrade/src/test/resources/operator_users.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
operator: | ||
- usernames: ["test_user"] |
16 changes: 16 additions & 0 deletions
16
...g-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/130_operator_privileges.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
"Test operator pivileges will work in the mixed cluster": | ||
ywangd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- skip: | ||
features: headers | ||
version: " - 7.10.99" | ||
reason: "operator privileges are available since 7.11" | ||
|
||
- do: | ||
ywangd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
cluster.delete_voting_config_exclusions: { } | ||
|
||
- do: | ||
catch: forbidden | ||
headers: # the non_operator user | ||
Authorization: Basic bm9uX29wZXJhdG9yOngtcGFjay10ZXN0LXBhc3N3b3Jk | ||
cluster.delete_voting_config_exclusions: { } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This method does not preserve response headers because the original threadContext is wrapped in a restorable that does not propogate the response headers:
elasticsearch/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/transport/SecurityServerTransportInterceptor.java
Lines 105 to 107 in 6192cb2
elasticsearch/server/src/main/java/org/elasticsearch/common/util/concurrent/ThreadContext.java
Lines 255 to 257 in 6192cb2
But I believe the response headers are actually preserved without this rewriting, i.e. when nodes are on the same version:
elasticsearch/server/src/main/java/org/elasticsearch/transport/TransportService.java
Lines 712 to 713 in 6192cb2
I don't think it needs to be addressed in this PR since it's been there for a long while and no issue has been raised AFAIK. But maybe in a follow-up?