novatechflow commented on PR #838:
URL: https://github.com/apache/wayang/pull/838#issuecomment-6410863104

   Took a bit longer to check and write a proper review since its sec relevant, 
three blockers still reproduced with Java 17:
   
   - `Number.class` permits custom subclasses whose `readObject() `hooks 
execute.
   - A payload type permits unrelated classes in its package; their hooks 
execute.
   - A fresh no-argument `WayangValue` rejects valid custom payloads.
   
   1. **Arbitrary subclasses remain allowed.**  
      
[ObjectFileSerialization.java:228–229](https://github.com/AliRana30/wayang/blob/91bacd75bbf0f2f0b529d8f96bdf84da535f7753/wayang-commons/wayang-basic/src/main/java/org/apache/wayang/basic/operators/ObjectFileSerialization.java#L228-L229)
 accepts any class assignable to the expected type. With `Number.class`, this 
includes custom `Number` subclasses, bypassing the earlier boxed-number 
restriction.
   
      **Implication:** custom `readObject()` hooks execute. The intended 
security boundary remains bypassable; actual harm depends on available classes 
and input control.
   
   2. **An expected type trusts its entire package and subpackages.**  
      
[ObjectFileSerialization.java:234–236](https://github.com/AliRana30/wayang/blob/91bacd75bbf0f2f0b529d8f96bdf84da535f7753/wayang-commons/wayang-basic/src/main/java/org/apache/wayang/basic/operators/ObjectFileSerialization.java#L234-L236)
 permits unrelated classes whose names start with the expected type’s package.
   
      **Implication:** selecting one legitimate payload class also permits 
unrelated classes and their deserialization hooks. The probe confirmed hook 
execution.
   
   3. **Fresh Flink values still lack the expected type.**  
      The [no-argument 
constructor](https://github.com/AliRana30/wayang/blob/91bacd75bbf0f2f0b529d8f96bdf84da535f7753/wayang-platforms/wayang-flink/src/main/java/org/apache/wayang/flink/compiler/criterion/WayangValue.java#L50-L53)
 sets both `data` and `type` to null. 
[Deserialization](https://github.com/AliRana30/wayang/blob/91bacd75bbf0f2f0b529d8f96bdf84da535f7753/wayang-platforms/wayang-flink/src/main/java/org/apache/wayang/flink/compiler/criterion/WayangValue.java#L143-L156)
 consequently installs a filter without an expected custom type.
   
      **Implication:** valid custom payloads fail with `InvalidClassException` 
when read into fresh instances. The [regression test manually supplies 
`CustomPayload.class`](https://github.com/AliRana30/wayang/blob/91bacd75bbf0f2f0b529d8f96bdf84da535f7753/wayang-platforms/wayang-flink/src/test/java/org/apache/wayang/flink/compiler/criterion/WayangValueTest.java#L91-L94),
 so it does not cover this failing path.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to