4 ms·
What he forgot to add: Some disadvantages of Mark, comparing to JSON would be: * Mark is insecure, JSON is secure. * Mark is slower than JSON Passing types
by rurban 9y ago
What he forgot to add:
Some disadvantages of Mark, comparing to JSON would be:
* Mark is insecure, JSON is secure.
* Mark is slower than JSON
Passing types directly to object.constructor is of course entirely insecure. https://github.com/rurban/Cpanel-JSON-XS/blob/master/XS.pm#L2052 https://github.com/rurban/Cpanel-JSON-XS/blob/master/XS.pm#L... (i.e. CVE-2015-1592)
- henryluo 9y agoThanks for feedback on the security aspect. It is something that Mark definitely needs to consider carefully. Current Mark implementation does not call arbitrary constructor during parsing. The constructors are created from scratch. But application users might want Mark to call their customer class constructor. I'm thinking passing in a callback function to Mark.parse().
- rurban 9y agoWhat YAML did in this aspect is providing a whitelist of allowed classnames.
- henryluo 9y agoWhen used for mixed content, Mark is not necessarily always slower than JSON. Many existing JSON-based DOM solutions, like JsonML and virtual-dom, need to use several JS objects to represent one element, but Mark uses only one JS object. However, I don't have time to do some benchmarking at the moment.