Skip to content
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

Better support wrapping of TransportChannel #3769

Merged
merged 4 commits into from
Nov 30, 2023

Conversation

cwperks
Copy link
Member

@cwperks cwperks commented Nov 27, 2023

Description

Performance Analyzer (PA) sets up a transport interceptor that wraps a TransportChannel. The security plugin has logic to extract the inner channel so that the rest of SecuritySSLRequestHandler uses the original channel. There is logic before the inner channel extraction to determine whether to use JDK Serialization if the incoming message was received from a node running OS <= 2.10. That code relies on channel.getVersion() to get the version of the node that transmitted the transport request, but when the channel is wrapped its not delegating to the original channel in PA. This PR moves the logic after the extraction of the inner channel to ensure that channel.getVersion() correctly returns the version from the transmitting node.

  • Category (Enhancement, New feature, Bug fix, Test fix, Refactoring, Maintenance, Documentation)

Bug fix

Issues Resolved

Testing

Will update with testing steps

Check List

  • New functionality includes testing
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

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.

Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
willyborankin
willyborankin previously approved these changes Nov 27, 2023
Copy link
Collaborator

@willyborankin willyborankin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: Craig Perkins <cwperx@amazon.com>
Copy link

codecov bot commented Nov 27, 2023

Codecov Report

Merging #3769 (fb3b091) into main (5114bb7) will increase coverage by 0.03%.
Report is 6 commits behind head on main.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3769      +/-   ##
==========================================
+ Coverage   65.24%   65.28%   +0.03%     
==========================================
  Files         297      297              
  Lines       21129    21133       +4     
  Branches     3451     3452       +1     
==========================================
+ Hits        13786    13796      +10     
+ Misses       5643     5640       -3     
+ Partials     1700     1697       -3     
Files Coverage Δ
...urity/ssl/transport/SecuritySSLRequestHandler.java 70.32% <100.00%> (+8.10%) ⬆️

... and 3 files with indirect coverage changes

@cwperks
Copy link
Member Author

cwperks commented Nov 28, 2023

See steps to reproduce here: #3771 (comment)

I have confirmed that this fix will ensure that channel.getVersion() returns the right version from the transmitting node (instead of the version of the receiving node).

When PA instantiates a PATransportChannel it does not copy the version from the original TransportChannel. Since it doesn't copy the version from the original, it will go with the default from TransportChannel which is the value of Version.CURRENT on the receiving node.

@parasjain1
Copy link
Contributor

LGTM

@cwperks cwperks added the backport 2.x backport to 2.x branch label Nov 30, 2023
@peternied peternied changed the title Move logic that determines whether to use JDK serialization after getInnerChannel to account for PA interceptor Better support wrapping of TransportChannel Nov 30, 2023
@cwperks cwperks merged commit 481b373 into opensearch-project:main Nov 30, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request Nov 30, 2023
…InnerChannel to account for PA interceptor (#3769)

### Description

Ensure that channel.getVersion() is called after extraction of inner channel.

Signed-off-by: Craig Perkins <cwperx@amazon.com>
(cherry picked from commit 481b373)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
willyborankin pushed a commit that referenced this pull request Nov 30, 2023
Backport 481b373 from #3769.

---------

Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Craig Perkins <cwperx@amazon.com>
prabhask5 pushed a commit to prabhask5/opensearch-security that referenced this pull request Jan 11, 2024
…InnerChannel to account for PA interceptor (opensearch-project#3769)

### Description

Ensure that channel.getVersion() is called after extraction of inner channel.

Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Prabhas Kurapati <prabhask@berkeley.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x backport to 2.x branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Wrong deserialization method is chosen in a mixed cluster of <2.11 and 2.11 nodes when PA is enabled
6 participants