-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Add case sensitivity as an argument to XContentMapValues.filter #19976
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
Add case sensitivity as an argument to XContentMapValues.filter #19976
Conversation
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
|
❌ Gradle check result for 9b955bc: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Signed-off-by: Craig Perkins <cwperx@amazon.com>
|
❌ Gradle check result for 499f406: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
❌ Gradle check result for 499f406: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Signed-off-by: Craig Perkins <cwperx@amazon.com>
|
I believe the existing |
|
❌ Gradle check result for 4efc679: null Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
jainankitk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering if we should add an option for case insensitive filter instead of changing the default behavior. That should allow addressing the issue for RestRequestFilter extension point in the short term, while keeping the default behavior. Changing default behavior can be separate decision in the longer term
|
Ack, I'll push a commit so that only the path within RestRequestFilter is case insensitive. |
Signed-off-by: Craig Perkins <cwperx@amazon.com>
…OpenSearch into case-insensitive-filter
|
❌ Gradle check result for 9c37810: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
❕ Gradle check result for 6fa0c70: UNSTABLE Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #19976 +/- ##
============================================
+ Coverage 73.23% 73.26% +0.02%
- Complexity 71544 71609 +65
============================================
Files 5786 5786
Lines 327013 327020 +7
Branches 47284 47289 +5
============================================
+ Hits 239498 239579 +81
- Misses 68245 68265 +20
+ Partials 19270 19176 -94 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@andrross @jainankitk I pushed a commit to add case sensitivity as a param so it can be used within RestRequestFilter. |
jainankitk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
server/src/main/java/org/opensearch/common/xcontent/support/XContentMapValues.java
Show resolved
Hide resolved
|
The backport to To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch/backport-2.19 2.19
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch/backport-2.19
# Create a new branch
git switch --create backport/backport-19976-to-2.19
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 ab4bd6937c3866e8e9fedf88479485a2c6e47ca3
# Push it to GitHub
git push --set-upstream origin backport/backport-19976-to-2.19
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch/backport-2.19Then, create a pull request where the |
…search-project/OpenSearch#19976 Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
…search-project#19976) * Make XContentMapValues.filter case insensitive Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add to CHANGELOG Signed-off-by: Craig Perkins <cwperx@amazon.com> * Fix precommit Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add caseSensitive flag Signed-off-by: Craig Perkins <cwperx@amazon.com> * Fix tests Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Craig Perkins <cwperx@amazon.com>
…search-project#19976) * Make XContentMapValues.filter case insensitive Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add to CHANGELOG Signed-off-by: Craig Perkins <cwperx@amazon.com> * Fix precommit Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add caseSensitive flag Signed-off-by: Craig Perkins <cwperx@amazon.com> * Fix tests Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Craig Perkins <cwperx@amazon.com>
Description
This PR solves an issue in the RestRequestFilter extension point that is used in cases to mark request params as sensitive so that the request is filtered in cases where the request body may be logged somewhere. Currently, it uses XContentMapValues.filter to perform the filtering, but implementers of this extension point would need to add all permutations of the field in getFilterFields due to the case sensitivity of the filtering.
I propose to make this case insensitive to filter out regardless of the casing.
This is particular useful for endpoints like https://docs.opensearch.org/latest/ml-commons-plugin/remote-models/index/#step-2-create-a-connector
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.