3 ms·
Again. Parsing is a minefield in general, but parsing JSON is one of the easiest tasks of all serialization formats. It's also the only secure format. Its var
by rurban 7y ago
Again.
Parsing is a minefield in general, but parsing JSON is one of the easiest tasks of all serialization formats.
It's also the only secure format.
Its various spec bugs (by omission) are not that dramatic, and the various "enhancements" only made it worse, ie more insecure. Still, bad but not a minefield. What worries me most that my JSON module is the defacto perl standard, passes all these tests, was the very first to add all these tests, is the fastest, and still is not included in that list, just some outdated modules which should not be used at all.
Checking best practices besides maintaining a spec obviously also is a minefield.
- rurban 7y agoI forgot another major JSON minefield problem which is not mentioned nor tested here: stackoverflow. This is in fact the most important problem to test against, because it might lead to exploitable stack ROP. JSON is usually parsed recursively, and deeply nested structures are mostly not depth counted. One can trivially construct a nested array or map of 500 to 30000 elements, and at one point the parser either fails or crashes with an overflow. This number is fixed, thus trivially exploitable. The test spec should contain the max. depth for arrays and maps, and if there's a fixed builtin limit, a compile-time limit, implicit limit by crash, or none. non recursive parsers are fine.