Skip to content

Commit

Permalink
Patch: Filter out blacklisted keys in og property name
Browse files Browse the repository at this point in the history
  • Loading branch information
samholmes committed Aug 3, 2021
1 parent ef532ed commit a0cef50
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)'
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit a0cef50

Please sign in to comment.