How to use secure-json-parse - 1 common examples

To help you get started, we’ve selected a few secure-json-parse examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fastify / fastify / lib / contentTypeParser.js View on Github external
function defaultJsonParser (req, body, done) {
    if (body === '' || body == null) {
      return done(new FST_ERR_CTP_EMPTY_JSON_BODY(), undefined)
    }

    try {
      var json = secureJson.parse(body, { protoAction: onProtoPoisoning })
    } catch (err) {
      err.statusCode = 400
      return done(err, undefined)
    }
    done(null, json)
  }
}

secure-json-parse

JSON parse with prototype poisoning protection

BSD-3-Clause
Latest version published 2 years ago

Package Health Score

78 / 100
Full package analysis

Popular secure-json-parse functions