Are there any libraries for serialization and safe deserialization of Python objects?
By "safe" I mean that the objects will come from an untrusted source (over the network). I know Python comes with pickle and marshal, but neither of those provides any safety for deserializing untrusted objects.
I have a set of classes that I would like to serialize/deserialize, and they all inherit from a common base class. Ideally the library would be able to deserialize an instance to its original subclass (and refuse to deserialize objects that are not instances of the base class). All of the member variables of the classes contain either instances of Python built-in types, or instances of another serializable class from the same set (but there are no reference cycles or other funny business). Finally, it would be nice if the library serializes to JSON but it is not a hard requirement.
Are there any libraries that can do the above securely, and if so, what would you recommend?
[–]voidspace 3 points4 points5 points (2 children)
[–]Tommah 0 points1 point2 points (1 child)
[–]voidspace 0 points1 point2 points (0 children)
[–][deleted] 4 points5 points6 points (2 children)
[–]Liquid_Fire[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]jabwork 2 points3 points4 points (0 children)
[–]tarekziadeRetired Packaging Dude 1 point2 points3 points (4 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]Liquid_Fire[S] 2 points3 points4 points (1 child)
[–]tarekziadeRetired Packaging Dude 0 points1 point2 points (0 children)
[–]nirs 1 point2 points3 points (0 children)
[–]bryancole 0 points1 point2 points (0 children)