ottypes / json0

Version 0 of the JSON OT type
447 stars 64 forks source link

Guard against prototype pollution in json0 #51

Open ericyhwang opened 8 months ago

ericyhwang commented 8 months ago

json0.apply has a prototype pollution security issue, where applying ops with path segments that match prototype property names can clobber said prototype properties. This can cause a DoS by crashing a server running json0. (We've just released safeguards in sharedb, which still uses json0 as the default type.)

This fixes the issue by throwing an error in json0.apply when encountering a path segment that matches the name of a prototype property.

Unrelated, this also pins the colors library to 1.4.0, since later versions are completely broken. It's a transitive dependency of ot-fuzzer > cli-progress.