Update RequestContentValidator to only validate fields from request payload and not pre-existing values stored in security index#6061
Open
cwperks wants to merge 4 commits intoopensearch-project:mainfrom
Conversation
…ayload and not pre-existing values stored in security index Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6061 +/- ##
==========================================
+ Coverage 73.98% 74.04% +0.05%
==========================================
Files 441 441
Lines 27413 27481 +68
Branches 4110 4123 +13
==========================================
+ Hits 20281 20347 +66
Misses 5193 5193
- Partials 1939 1941 +2
🚀 New features to boost your workflow:
|
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@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.
Description
This PR contains a fix for using PATCH API with the security plugin to update security configs like internal users.
This PR relates to the following 3 PRs:
Prior to opensearch-project/security-dashboards-plugin#2330, when internal users would be created through OSD then they would automatically get empty string ("") pre-populated in the list of backend roles.
With the new API validations added in #5714, a user making a PATCH request can get a BAD_REQUEST error if the internaluser being edited has an empty string already stored in the security index regardless if the request payload is modifying this field.
For example in my internalusers.yml file I put:
and then try to update the hash via API using PATCH. It fails:
With the change in this PR, the request would succeed bc the validation would only apply on the request payload itself.
Bugfix
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.