Add process-wide ObjectInputFilter to reject Java deserialization by default - #22073
Conversation
…lso enforce at runtime Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
PR Reviewer Guide 🔍(Review updated until commit aca4592)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to aca4592
Previous suggestionsSuggestions up to commit 876ec79
|
|
❌ Gradle check result for 876ec79: 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? |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #22073 +/- ##
============================================
- Coverage 73.43% 73.41% -0.03%
+ Complexity 75965 75894 -71
============================================
Files 6070 6070
Lines 344903 344913 +10
Branches 49625 49626 +1
============================================
- Hits 253285 253207 -78
+ Misses 71493 71467 -26
- Partials 20125 20239 +114 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Persistent review updated to latest commit aca4592 |
…default (opensearch-project#22073) * Extend forbidden api for java serialization from build-time only to also enforce at runtime Signed-off-by: Craig Perkins <cwperx@amazon.com> Co-authored-by: Sandesh Kumar <sandeshkr419@gmail.com>
…default (opensearch-project#22073) * Extend forbidden api for java serialization from build-time only to also enforce at runtime Signed-off-by: Craig Perkins <cwperx@amazon.com> Co-authored-by: Sandesh Kumar <sandeshkr419@gmail.com>
Description
This PR installs a process-wide ObjectInputFilter factory via ObjectInputFilter.Config.setSerialFilterFactory() during bootstrap. The factory rejects all Java deserialization by default. Code that legitimately requires deserialization can opt in by setting a filter on their ObjectInputStream, which the factory will delegate to.
This complements the existing forbidden-apis build-time check by providing runtime enforcement across the entire process, including plugins and third-party dependencies. Plugins that need deserialization (like the security plugin) can still override this filter with setObjectInputFilter with a separate filter. This filter will behave similar to JSM where any issues from plugins would arise at runtime instead of compile time.
This filter is gated behind the
bootstrap.serial_filtersetting (disabled by default, requires node restart):bootstrap.serial_filter: trueCheck 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.