-
Notifications
You must be signed in to change notification settings - Fork 285
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
Add ensureCustomSerialization to ensure that headers are serialized correctly with multiple transport hops #4741
Add ensureCustomSerialization to ensure that headers are serialized correctly with multiple transport hops #4741
Conversation
…orrectly with multiple transport hops Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4741 +/- ##
==========================================
- Coverage 65.54% 65.54% -0.01%
==========================================
Files 319 319
Lines 22448 22470 +22
Branches 3602 3604 +2
==========================================
+ Hits 14714 14728 +14
- Misses 5927 5933 +6
- Partials 1807 1809 +2
|
What a scenario - great job tracking this down @cwperks |
src/main/java/org/opensearch/security/transport/SecurityInterceptor.java
Show resolved
Hide resolved
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
src/test/java/org/opensearch/security/transport/SecurityInterceptorTests.java
Show resolved
Hide resolved
The backport to
To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/security/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/security/backport-2.x
# Create a new branch
git switch --create backport/backport-4741-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 8ae88a7049291abc3be2003552a04fbc6d092fb1
# Push it to GitHub
git push --set-upstream origin backport/backport-4741-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/security/backport-2.x Then, create a pull request where the |
@cwperks Could you plz prepare a manual backport? |
…orrectly with multiple transport hops (opensearch-project#4741) Signed-off-by: Craig Perkins <cwperx@amazon.com> (cherry picked from commit 8ae88a7)
Opened a backport here: #4743 |
…orrectly with multiple transport hops (opensearch-project#4741) Signed-off-by: Craig Perkins <cwperx@amazon.com> Signed-off-by: tmanninger <t.manninger@ixolit.com>
Description
This PR fixes multiple issues:
When upgrading from 2.11/2.12/2.13 to >= 2.14, there can be an issue when deserializing threadContext headers on the receiving node due to the transmitting node re-using the serialization format from a previous transport hop.
This was particularly seen in scenarios where there is a chain of transport hops, such as 2.14 (Coordinator node) -> 2.14 node -> 2.12 node
These scenarios can happen on ingestion during rolling upgrades where a replica shard may temporarily be on an older node than a primary shard.
This PR adds logic in the SecurityInterceptor to re-serialize the headers if they have previously been populated from a prior transport hop for backwards compatibility.
This PR adds a version check to the logic around ensureJdkSerialization and ensureCustomSerialization to only execute the logic in a mixed cluster containing nodes < 2.14. If all nodes are >= 2.14 then this logic is redundant and adds additional overhead.
Bug fix
Issues Resolved
Testing
Creating this PR in Draft until testing details are added.
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.