forked from keymetrics/cli-tableau
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(security): 🔒 Prototype Pollution in cli-tableau
Correction to issue keymetrics#10
- Loading branch information
Showing
7 changed files
with
106 additions
and
68 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
lib-cov | ||
node_modules | ||
.vscode | ||
package-lock.json |
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 |
---|---|---|
@@ -1,55 +1,80 @@ | ||
|
||
/** | ||
* Module requirements. | ||
*/ | ||
|
||
var Table = require('../lib') | ||
var Table = require("../lib"); | ||
|
||
/** | ||
* Example. | ||
*/ | ||
|
||
/* col widths */ | ||
var table = new Table({ | ||
head: ['Rel', 'Change', 'By', 'When'], | ||
colWidths: [6, 21, 25, 17] | ||
}) | ||
head: ["Rel", "Change", "By", "When"], | ||
colWidths: [6, 21, 25, 17], | ||
}); | ||
|
||
table.push( | ||
['v0.1', 'Testing something cool', 'rauchg@gmail.com', '7 minutes ago'] | ||
, ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '8 minutes ago'] | ||
) | ||
["v0.1", "Testing something cool", "rauchg@gmail.com", "7 minutes ago"], | ||
["v0.1", "Testing something cool", "rauchg@gmail.com", "8 minutes ago"] | ||
); | ||
|
||
console.log(table.toString()) | ||
console.log(table.toString()); | ||
|
||
/* compact */ | ||
var table2 = new Table({ | ||
head: ['Rel', 'Change', 'By', 'When'], | ||
head: ["Rel", "Change", "By", "When"], | ||
colWidths: [6, 21, 25, 17], | ||
style: {compact: true, 'padding-left': 1} | ||
}) | ||
style: { compact: true, "padding-left": 1 }, | ||
}); | ||
|
||
table2.push( | ||
['v0.1', 'Testing something cool', 'rauchg@gmail.com', '7 minutes ago'] | ||
, ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '8 minutes ago'] | ||
, [] | ||
, ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '8 minutes ago'] | ||
) | ||
["v0.1", "Testing something cool", "rauchg@gmail.com", "7 minutes ago"], | ||
["v0.1", "Testing something cool", "rauchg@gmail.com", "8 minutes ago"], | ||
[], | ||
["v0.1", "Testing something cool", "rauchg@gmail.com", "8 minutes ago"] | ||
); | ||
|
||
console.log(table.toString()) | ||
console.log(table.toString()); | ||
|
||
/* headless */ | ||
var headlessTable = new Table() | ||
headlessTable.push(['v0.1', 'Testing something cool', 'rauchg@gmail.com', '7 minutes ago']) | ||
console.log(headlessTable.toString()) | ||
var headlessTable = new Table(); | ||
headlessTable.push([ | ||
"v0.1", | ||
"Testing something cool", | ||
"rauchg@gmail.com", | ||
"7 minutes ago", | ||
]); | ||
console.log(headlessTable.toString()); | ||
|
||
/* vertical */ | ||
var verticalTable = new Table() | ||
verticalTable.push({'Some Key': 'Some Value'}, {'Another much longer key': 'And its corresponding longer value'}) | ||
var verticalTable = new Table(); | ||
verticalTable.push( | ||
{ "Some Key": "Some Value" }, | ||
{ "Another much longer key": "And its corresponding longer value" } | ||
); | ||
|
||
console.log(verticalTable.toString()) | ||
console.log(verticalTable.toString()); | ||
|
||
/* cross */ | ||
var crossTable = new Table({head: ['', 'Header #1', 'Header #2']}) | ||
crossTable.push({'Header #3': ['Value 1', 'Value 2']}, {'Header #4': ['Value 3', 'Value 4']}) | ||
console.log(crossTable.toString()) | ||
var crossTable = new Table({ head: ["", "Header #1", "Header #2"] }); | ||
crossTable.push( | ||
{ "Header #3": ["Value 1", "Value 2"] }, | ||
{ "Header #4": ["Value 3", "Value 4"] } | ||
); | ||
console.log(crossTable.toString()); | ||
|
||
/* Prototype Pollution in cli-tableau */ | ||
let attackerObject = | ||
'{"__proto__":{"attackerControlledValue":"Attackers Payload"},"proto":{"attackPropFromProto":"changed"},"constructor":{"prototype":{"attackPropFromConstructorProto":"changed"}}}'; | ||
|
||
let attackedTable = new Table(JSON.parse(attackerObject)); | ||
|
||
attackedTable.push({ | ||
Vulnerability: [ | ||
"Prototype Pollution", | ||
!!attackedTable.options.attackerControlledValue, | ||
], | ||
}); | ||
|
||
console.log(attackedTable.toString()); |
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