Skip to content

Releases: fastify/secure-json-parse

v2.1.0

15 Jan 16:20
Compare
Choose a tag to compare

📚 PR:

  • Ignore BOM char (#5)

v2.0.0

23 Oct 16:31
Compare
Choose a tag to compare

Now the library also detects the use of the constructor key, as it was doing with the __proto__ key.
parse will throw an error by default, while safeParse will continue to work as before.

// old behavior
j.parse(
  '{"a": 5, "b": 6, "constructor":{"prototype":{"bar":"baz"}}, "__proto__": { "x": 7 } }',
  { protoAction: 'remove' }
) // => { a: 5: b:6, constructor: { prototype: { bar: 'baz' } } }

// new bahavior
j.parse(
  '{"a": 5, "b": 6, "constructor":{"prototype":{"bar":"baz"}}, "__proto__": { "x": 7 } }',
  { protoAction: 'remove' }
) // => SyntaxError

// for having the same behavior as before:
j.parse(
  '{"a": 5, "b": 6, "constructor":{"prototype":{"bar":"baz"}}, "__proto__": { "x": 7 } }',
  { protoAction: 'remove', constructorAction: 'ignore' }
) // => { a: 5: b:6, constructor: { prototype: { bar: 'baz' } } }

Features:

  • Added support for constructorAction - #4

v1.0.0

30 Apr 07:29
0c7b41e
Compare
Choose a tag to compare
  • Initial release