Repository navigation
Conversation
|
@zkaoudi Pr is up for your review. |
|
Thanks for the fix. Three issues to address before merging:
Reproduced all three on Java 17. Please tighten the allowlist and add regression tests. |
05351a2 to
c2850f7
Compare
|
@novatechflow Updated the allowlist and WayangValue as per the feedback. Alos added regression tests for all three cases in |
Immutable collections now round-trip correctly, and deserialization failures propagate instead of silently returning null. Great work! |
c2850f7 to
91bacd7
Compare
|
@novatechflow Updated the PR and added the following : |
|
Took a bit longer to check and write a proper review since its sec relevant, three blockers still reproduced with Java 17:
|
91bacd7 to
6c24cbc
Compare
|
Thanks for the thorough review and security probes. @novatechflow
|
|
Thanks, the previous three issues are fixed. One security issue comes with the new type header:
So the input itself decides which class to trust. Reproduced on Java 17: an otherwise rejected custom class executes its The expected type needs to come from trusted configuration or an allowlist, rather than the stream. Please add a regression test for this case. |
6c24cbc to
7527c1a
Compare
|
hi @novatechflow Thanks for the thorough review and security probe findings! All three issues along with additional Java 17 edge cases have been resolved and covered by regression tests:
|
|
the Im still getting familiar with this codebase, so I might be missing some context. happy to hear your thoughts |
|
Thanks for the update, and @Kaileshwar16, your concerns are valid. Rechecked on Java 17: the stream-selected class still executes its The resource-limit concern is valid too: there are no local depth, array-size, or reference limits. Please resolve the expected type from trusted configuration or an allowlist and add regression tests for these cases. |
…ource limits, and allow Object/List payloads
|
Thanks @novatechflow and @Kaileshwar16 for the review! Pushed a follow-up commit fixing all points:
|
| if (current.getName().startsWith("scala.Tuple") || | ||
| current.getName().startsWith("scala.collection.")) { | ||
| return true; | ||
| } |
There was a problem hiding this comment.
Would it be safer to restrict the Scala allowlist to known library classes?
What changes?
ObjectFileSerialization:createObjectInputFilter(Class<?> elementType)to restrict legacy object deserialization to expected primitives, wrappers, standard safe collections, Wayang types, Scala tuples, and expectedelementTypehierarchies.wayang.basic.serialization.allowlist.InvalidClassException.WayangValue:ObjectInputFilteron Flink criterion deserialization.convertToByteandconvertToObjectto use try-with-resources.elementTypeacceptance, and system property pattern matching.Why are the changes needed?
Directly calling
ObjectInputStream.readObject()without anObjectInputFilterallows arbitrary class instantiation, posing a deserialization security risk (CWE-502).How was this tested?
ObjectFileSerializationTestandWayangValueTest.mvn testonwayang-basicandwayang-flink.mvn apache-rat:check.Closes : #835