Class DeserializationFilter

java.lang.Object
com.dna.jopt.io.shared.DeserializationFilter
All Implemented Interfaces:
ObjectInputFilter

public final class DeserializationFilter extends Object implements ObjectInputFilter
The allow list for Java deserialization in the core.

Every ObjectInputStream that the core reads gets this filter (the container import of EntityContainerImporter and the legacy license stream of IOptimization.setLicense(ObjectInputStream)). The filter accepts the core's own classes ( com.dna.jopt.**) and only the JDK and library classes that a serialized container or license holds: boxed numbers, java.time values, the expiry date of the license, JDK collections, the Guava table of the node connector and the quantities and units of javax.measure. Every other class is rejected before it is created, so a stream cannot bring further classes of the JDK or of a library into the process, for example collections whose deserialization is known to be unsafe.

The filter sets no limits on depth, references, array length or stream size: they grow with the size of a container, and no fixed value is safe for every legal container.

A JVM-wide filter (the system property jdk.serialFilter) keeps applying: a class has to pass both. A refused class makes readObject throw an InvalidClassException; describe(InvalidClassException) names the refused class.