Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

class whitelisting for deserialization #5891

Open
tombentley opened this issue Jan 8, 2016 · 6 comments
Open

class whitelisting for deserialization #5891

tombentley opened this issue Jan 8, 2016 · 6 comments

Comments

@tombentley
Copy link

As discussed in this mailing list thread, for applications which deserialize untrusted data there's some security merit in being able to say at compile time what classes you expect to have to deserialize. This could be handled entirely by serialization libraries, but putting it in the serialization API makes it trivial for serialization library authors to implement.

Specifically this could be done by adding a functional parameter to deserialization():

shared DeserializationContext<Id> deserialization<Id>(Boolean whitelisted(ClassModel<> clazz) => true)

If the serialization API was asked to instantiate any class for which whitelisted() returned false an exception would be thrown.

@tombentley
Copy link
Author

Discuss.

@tombentley
Copy link
Author

I've implemented this on the s11n branch, which will be merged for 1.2.2, so reassigning.

@tombentley tombentley modified the milestones: 1.2.2, 1.2.1 Jan 18, 2016
@FroMage FroMage modified the milestones: 1.2.2, 1.2.3 Feb 18, 2016
@simonthum
Copy link

Hi Tom,

great you took it up! I find it well done and it has instructive tests. From a security perspecive it would maybe need some helpers e.g. to whitelist "org.myorg." and "ceylon." easily enough to get used in practice, but that can be done any time.

I would, however, suggest adding a serialization (i.e. not de-serialization) counterpart. This would make it easy to support older API versions, e.g. my server needs to support on old client that I know cannot handle certain types. By blacklisting types or evaluating their apiLevel tags during serialization I could help ensure my backwards compatibility guarantees in simple unit tests.

@quintesse
Copy link
Contributor

Btw, this was reassigned to 1.2.3

@simonthum
Copy link

Regarding my last comment, the serialization counterpart could be informed by #6075 output, or the tool could even produce white/blacklisting code from API diffs for those who don't like maintaining compatibility level annotations.

@quintesse
Copy link
Contributor

@tombentley is this still for 1.2.3?

@gavinking gavinking modified the milestones: 1.3, 1.2.3 Aug 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants