diff --git a/index.js b/index.js index 50a6020..be75277 100644 --- a/index.js +++ b/index.js @@ -10,6 +10,11 @@ var shorthandProperties = { "audio": "audio:url" } +var keyBlacklist = [ + '__proto__', + 'constructor', + 'prototype' +] exports = module.exports = function(url, cb, options){ var userAgent = (options || {}).userAgent || 'NodeOpenGraphCrawler (https://github.com/samholmes/node-open-graph)' @@ -122,6 +127,8 @@ exports.parse = function($, options){ while (keys.length > 1) { key = keys.shift(); + if (keyBlacklist.includes(key)) continue + if (Array.isArray(ptr[key])) { // the last index of ptr[key] should become // the object we are examining.