hacksparrow / safe-eval

Safer version of eval()
257 stars 37 forks source link

Modifies Object #12

Open cpcallen opened 6 years ago

cpcallen commented 6 years ago

Calling safeEval causes a constructor property to be added to Object in the caller's realm:

console.log(Object.getOwnPropertyDescriptor(Object, 'constructor'));
console.log(safeEval('42'));
console.log(Object.getOwnPropertyDescriptor(Object, 'constructor'));

Output:

undefined
42
{ value: undefined,
  writable: true,
  enumerable: true,
  configurable: true }