[Backport 2.x] Add early rejection from RestHandler for unauthorized requests (#3418)#3496
Merged
stephen-crawford merged 2 commits into2.xfrom Oct 9, 2023
Merged
Conversation
… requests (#3418) (#3495) ### Description Backport of 6b0b682 from #3418 Previously unauthorized requests were fully processed and rejected once they reached the RestHandler. This allocations more memory and resources for these requests that might not be useful if they are already detected as unauthorized. Using the headerVerifer and decompressor customization from [1], perform an early authorization check when only the headers are available, save an 'early response' for transmission and do not perform the decompression on the request to speed up closing out the connection. - Resolves opensearch-project/OpenSearch#10260 Signed-off-by: Peter Nied <petern@amazon.com> Signed-off-by: Craig Perkins <cwperx@amazon.com> Signed-off-by: Craig Perkins <craig5008@gmail.com> Co-authored-by: Craig Perkins <cwperx@amazon.com> (cherry picked from commit f7c47af)
Signed-off-by: Peter Nied <petern@amazon.com>
Codecov Report
@@ Coverage Diff @@
## 2.x #3496 +/- ##
============================================
+ Coverage 64.73% 64.86% +0.13%
- Complexity 3570 3613 +43
============================================
Files 267 273 +6
Lines 19893 20025 +132
Branches 3329 3346 +17
============================================
+ Hits 12877 12989 +112
- Misses 5377 5389 +12
- Partials 1639 1647 +8
|
willyborankin
approved these changes
Oct 7, 2023
DarshitChanpura
approved these changes
Oct 9, 2023
peternied
added a commit
to peternied/security
that referenced
this pull request
Oct 9, 2023
…requests (opensearch-project#3418) (opensearch-project#3496) Backport f7c47af from opensearch-project#3495 --------- Signed-off-by: Peter Nied <petern@amazon.com> Co-authored-by: Peter Nied <petern@amazon.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Backport f7c47af from #3495