Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fixed a security issue allowing to execute aritrary JavaScript code v…
…ia a specially prepared function name of a typed function
- Loading branch information
Showing
3 changed files
with
30 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| var assert = require('assert'); | ||
| var typed = require('../typed-function'); | ||
|
|
||
| describe('security', function () { | ||
|
|
||
| it ('should not allow bad code in the function name', function () { | ||
| // simple example: | ||
| // var fn = typed("(){}+console.log('hacked...');function a", { | ||
| // "": function () {} | ||
| // }); | ||
|
|
||
| // example resulting in throwing an error | ||
| var fn = typed("(){}+(function(){throw new Error('Hacked... should not have executed this function!!!')})();function a", { | ||
| "": function () {} | ||
| }); | ||
| }) | ||
| }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters