Skip to content

Commit 74e5bb8

Browse files
committed
refactor: rename saferEval.spce.js
1 parent 457bbfd commit 74e5bb8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/saferEval.js test/saferEval.spec.js

+8
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,14 @@ describe('#saferEval', function () {
270270
}
271271
assert.strictEqual(res, undefined)
272272
})
273+
it('should prevent a breakout using Object.constructor', function () {
274+
let res
275+
try {
276+
res = saferEval(`{}.constructor.constructor("return this.constructor.constructor('return this')()")().process.mainModule.require('child_process').execSync('pwd').toString()`)
277+
} catch (e) {
278+
}
279+
assert.strictEqual(res, undefined)
280+
})
273281
})
274282

275283
describeBrowser('in browser', function () {

0 commit comments

Comments
 (0)