security.test.js (548B)
1 var assert = require('assert'); 2 var typed = require('../typed-function'); 3 4 describe('security', function () { 5 6 it ('should not allow bad code in the function name', function () { 7 // simple example: 8 // var fn = typed("(){}+console.log('hacked...');function a", { 9 // "": function () {} 10 // }); 11 12 // example resulting in throwing an error if successful 13 var fn = typed("(){}+(function(){throw new Error('Hacked... should not have executed this function!!!')})();function a", { 14 "": function () {} 15 }); 16 }) 17 })