-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Pass registry of headers from ActionPlugin.getRestHeaders to ActionPlugin.getRestHandlerWrapper #19875
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
Pass registry of headers from ActionPlugin.getRestHeaders to ActionPlugin.getRestHandlerWrapper #19875
Conversation
…ugin.getRestHandlerWrapper Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #19875 +/- ##
============================================
+ Coverage 73.09% 73.10% +0.01%
- Complexity 71060 71109 +49
============================================
Files 5754 5754
Lines 325230 325260 +30
Branches 47035 47036 +1
============================================
+ Hits 237735 237792 +57
- Misses 68359 68369 +10
+ Partials 19136 19099 -37 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ugin.getRestHandlerWrapper (opensearch-project#19875) * Pass registry of headers from ActionPlugin.getRestHeaders to ActionPlugin.getRestHandlerWrapper Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add to CHANGELOG Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Craig Perkins <cwperx@amazon.com>
|
So, fun fact -- this change will break any plugins that implemented I'm thinking it would be a good idea to add an overloaded signature for backwards compatibility. That is, something like: I'm a little shocked that the BWC check will complain about a change to public methods on the |
|
@msfroh I plan to raise a PR shortly after talking with @aparajita31pandey. We did something similar for a recent change in ActionFilter here: https://github.com/opensearch-project/OpenSearch/blob/main/server/src/main/java/org/opensearch/action/support/ActionFilter.java#L70-L106 |
…ugin.getRestHandlerWrapper (opensearch-project#19875) * Pass registry of headers from ActionPlugin.getRestHeaders to ActionPlugin.getRestHandlerWrapper Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add to CHANGELOG Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Craig Perkins <cwperx@amazon.com>
Description
Effectively, the security plugin is the only implementer of ActionPlugin.getRestHandlerWrapper and needs this registry to now which headers are explicitly allowlisted to be carried internally within the transport layer in order to trace a requests end-to-end through the entire lifecycle of a request.
Currently, security has logic to sanitize the threadcontext headers on internal transport requests so there's an existing bug in the ActionPlugin.getRestHeaders extension point when running a cluster with security. Security has created a PR to fix the bug, but it uses TheadContext.getHeaders() which creates an new HashMap on every call.
We would like to avoid that and explicitly call
ThreadContext.getHeader(String headerName), but that requires knowing the header name to allowlist. With the changes in this PR, security will be able to iterate through the registry accordingly.Related Issues
Resolves opensearch-project/security#4799
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.