Skip to content

Commit

Permalink
refactor: rename saferEval.spce.js
Browse files Browse the repository at this point in the history
  • Loading branch information
commenthol committed Mar 9, 2019
1 parent 457bbfd commit 74e5bb8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/saferEval.js → test/saferEval.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,14 @@ describe('#saferEval', function () {
}
assert.strictEqual(res, undefined)
})
it('should prevent a breakout using Object.constructor', function () {
let res
try {
res = saferEval(`{}.constructor.constructor("return this.constructor.constructor('return this')()")().process.mainModule.require('child_process').execSync('pwd').toString()`)
} catch (e) {
}
assert.strictEqual(res, undefined)
})
})

describeBrowser('in browser', function () {
Expand Down

0 comments on commit 74e5bb8

Please sign in to comment.