opensearch-project / security

🔐 Secure your cluster with TLS, numerous authentication backends, data masking, audit logging as well as role-based access control on indices, documents, and fields
https://opensearch.org/docs/latest/security-plugin/index/
Apache License 2.0
180 stars 264 forks source link

Fix DelegatingRestHandlerTests #4434

Closed reta closed 3 weeks ago

reta commented 3 weeks ago

Description

Fix DelegatingRestHandlerTests

Issues Resolved

Caused by https://github.com/opensearch-project/OpenSearch/pull/13772

Is this a backport? If so, please add backport PR # and/or commits #

Testing

N/A

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.

reta commented 3 weeks ago

Come up in https://github.com/opensearch-project/security/pull/4432#issuecomment-2160045889 , thanks to @nibix

codecov[bot] commented 3 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 65.44%. Comparing base (0aed8f9) to head (1fd98c6). Report is 4 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/opensearch-project/security/pull/4434/graphs/tree.svg?width=650&height=150&src=pr&token=rBpySfQXMt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project)](https://app.codecov.io/gh/opensearch-project/security/pull/4434?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project) ```diff @@ Coverage Diff @@ ## main #4434 +/- ## ========================================== + Coverage 65.42% 65.44% +0.02% ========================================== Files 310 312 +2 Lines 22013 22042 +29 Branches 3556 3559 +3 ========================================== + Hits 14401 14426 +25 - Misses 5841 5843 +2 - Partials 1771 1773 +2 ``` | [Files](https://app.codecov.io/gh/opensearch-project/security/pull/4434?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project) | Coverage Δ | | |---|---|---| | [...nsearch/security/filter/DelegatingRestHandler.java](https://app.codecov.io/gh/opensearch-project/security/pull/4434?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fopensearch%2Fsecurity%2Ffilter%2FDelegatingRestHandler.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project#diff-c3JjL21haW4vamF2YS9vcmcvb3BlbnNlYXJjaC9zZWN1cml0eS9maWx0ZXIvRGVsZWdhdGluZ1Jlc3RIYW5kbGVyLmphdmE=) | `93.33% <100.00%> (+0.47%)` | :arrow_up: | ... and [2 files with indirect coverage changes](https://app.codecov.io/gh/opensearch-project/security/pull/4434/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project)
peternied commented 3 weeks ago

What do you think about moving the delegating handler into core so this is avoided in future iterations?

reta commented 3 weeks ago

What do you think about moving the delegating handler into core so this is avoided in future iterations?

@peternied core has nothing to do with this change: in core the change is non-breaking and adds default method to RestHandler. The security plugin uses own DelegatingRestHandler and reflection APIs to check all RestHandler methods are "intercepted", the alternative here would be to use generated proxy (instead of hardcoded DelegatingRestHandler) in the security plugin.