-
-
Notifications
You must be signed in to change notification settings - Fork 775
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Close security issue in !!js/function constructor.
Prevent it from code execution on parsing. Thanks to @nealpoole for report.
- Loading branch information
Dervus Grim
committed
Apr 26, 2013
1 parent
6853fa1
commit 430f880
Showing
6 changed files
with
60 additions
and
5 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
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
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,3 @@ | ||
tests: | ||
- !!js/function 'makeBadThing("BAD THING 1")' | ||
- !!js/function 'function () { makeBadThing("BAD THING 2") }.call(this)' |
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,22 @@ | ||
'use strict'; | ||
/*global it */ | ||
|
||
|
||
var assert = require('assert'); | ||
|
||
|
||
var badThings = []; | ||
|
||
|
||
global.makeBadThing = function (thing) { | ||
badThings.push(thing); | ||
}; | ||
|
||
|
||
it('Function constructor must not allow to execute any code while parsing.', function () { | ||
assert.throws(function () { | ||
require('./data/issue-parse-function-security.yml'); | ||
}); | ||
|
||
assert.deepEqual(badThings, []); | ||
}); |