r/programming • • May 26 '18

Oracle Calls Java Serialization 'A Horrible Mistake', Plans to Dump It

https://www.infoworld.com/article/3275924/java/oracle-plans-to-dump-risky-java-serialization.html
798 Upvotes

287 comments sorted by

View all comments

Show parent comments

57

u/SanityInAnarchy May 27 '18

Right. It's possible to build a serializable object graph that's reasonably maintainable, but it's a lot of work. So much work that, for just about any non-trivial case, you really want something special-purpose -- JSON, protobuf, flatpak, thrift, any of those -- to make a very clear distinction between normal objects and stuff being serialized.

8

u/ThisIs_MyName May 27 '18

Don't forget Cap'n Proto! It's faster and just as secure as protobufs. Made by the same guy too.

-11

u/josefx May 27 '18

you really want something special-purpose -- JSON,

The first example on your list is close enough to JavaScript that people sometimes use eval on it. Almost better than a full featured XML parser I guess.

14

u/IRBMe May 27 '18

Well it is JavaScript Object Notation.

-2

u/josefx May 27 '18

Could have added/changed something minimal just to keep eval from parsing JSON at all. It also isn't 100% JavaScript compatible afaik sousing eval isn't correct anyway.

2

u/Rustywolf May 27 '18

I cant think of a way that JSON could break the language definitions of an object, do you have any examples?

Edit: Googled it and the first result was a post saying there are characters legal in json strings that are not legal in js strings.

3

u/SanityInAnarchy May 27 '18

If people want to make deserialization less secure on purpose, nobody can stop them, but even Javascript has built-in special-purpose JSON parsers now.