-
Notifications
You must be signed in to change notification settings - Fork 138
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 an array filter to our serialize/deserialize methods and narrow down previous filter #849
Conversation
…own previous filter Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## 2.x #849 +/- ##
=========================================
Coverage 84.81% 84.82%
Complexity 1628 1628
=========================================
Files 135 135
Lines 6079 6083 +4
Branches 596 596
=========================================
+ Hits 5156 5160 +4
Misses 666 666
Partials 257 257
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
ml-algorithms/src/main/java/org/opensearch/ml/engine/utils/ModelSerDeSer.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
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.
LGTM. Thanks
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-849-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 0997d6cbc247b705c340e31480e381513d3a8691
# Push it to GitHub
git push --set-upstream origin backport/backport-849-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x Then, create a pull request where the |
…own previous filter (#849) * Add an array filter to our serialize/deserialize methods and narrow down previous filter Signed-off-by: Sicheng Song <sicheng.song@outlook.com> * Further narrowing down accept list Signed-off-by: Sicheng Song <sicheng.song@outlook.com> * Keep narrowing down accept list Signed-off-by: Sicheng Song <sicheng.song@outlook.com> * Add test for deserialization methods in all built-in models Signed-off-by: Sicheng Song <sicheng.song@outlook.com> --------- Signed-off-by: Sicheng Song <sicheng.song@outlook.com> (cherry picked from commit 0997d6c)
…own previous filter (#849) (#857) * Add an array filter to our serialize/deserialize methods and narrow down previous filter Signed-off-by: Sicheng Song <sicheng.song@outlook.com> * Further narrowing down accept list Signed-off-by: Sicheng Song <sicheng.song@outlook.com> * Keep narrowing down accept list Signed-off-by: Sicheng Song <sicheng.song@outlook.com> * Add test for deserialization methods in all built-in models Signed-off-by: Sicheng Song <sicheng.song@outlook.com> --------- Signed-off-by: Sicheng Song <sicheng.song@outlook.com> (cherry picked from commit 0997d6c) Co-authored-by: Sicheng Song <sicheng.song@outlook.com>
…own previous filter (opensearch-project#849) * Add an array filter to our serialize/deserialize methods and narrow down previous filter Signed-off-by: Sicheng Song <sicheng.song@outlook.com> * Further narrowing down accept list Signed-off-by: Sicheng Song <sicheng.song@outlook.com> * Keep narrowing down accept list Signed-off-by: Sicheng Song <sicheng.song@outlook.com> * Add test for deserialization methods in all built-in models Signed-off-by: Sicheng Song <sicheng.song@outlook.com> --------- Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
…own previous filter (opensearch-project#849) * Add an array filter to our serialize/deserialize methods and narrow down previous filter Signed-off-by: Sicheng Song <sicheng.song@outlook.com> * Further narrowing down accept list Signed-off-by: Sicheng Song <sicheng.song@outlook.com> * Keep narrowing down accept list Signed-off-by: Sicheng Song <sicheng.song@outlook.com> * Add test for deserialization methods in all built-in models Signed-off-by: Sicheng Song <sicheng.song@outlook.com> --------- Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
Description
Previous we did not add filter to the depth and byte array length to our deserialization method, which can cause a denial of service attack via very long arrays or nested objects. Meanwhile we have an allowlist that is too general so malicious files could potentially bypass. Now we narrow down the allowlist, add a reject list, and also add a depth and length filter. In long term we will try to change this byte stream deserialization method into json or protocol buffer.
Issues Resolved
This is a short-term fix in regards to a security ticket.
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.