File tree Expand file tree Collapse file tree 4 files changed +27
-0
lines changed
test/library-tests/TaintTracking Expand file tree Collapse file tree 4 files changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ lgtm,codescanning
2
+ * The dataflow libraries now model dataflow through more JSON utility libraries.
3
+ Affected packages are
4
+ [ json2csv] ( https://npmjs.com/package/json2csv )
Original file line number Diff line number Diff line change @@ -34,3 +34,22 @@ class JsonStringifyCall extends DataFlow::CallNode {
34
34
*/
35
35
DataFlow:: SourceNode getOutput ( ) { result = this }
36
36
}
37
+
38
+ /**
39
+ * A taint step through the [`json2csv`](https://www.npmjs.com/package/json2csv) library.
40
+ */
41
+ class JSON2CSVTaintStep extends TaintTracking:: SharedTaintStep {
42
+ override predicate step ( DataFlow:: Node pred , DataFlow:: Node succ ) {
43
+ exists ( API:: CallNode call |
44
+ call =
45
+ API:: moduleImport ( "json2csv" )
46
+ .getMember ( "Parser" )
47
+ .getInstance ( )
48
+ .getMember ( "parse" )
49
+ .getACall ( )
50
+ |
51
+ pred = call .getArgument ( 0 ) and
52
+ succ = call
53
+ )
54
+ }
55
+ }
Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ typeInferenceMismatch
90
90
| json-stringify.js:2:16:2:23 | source() | json-stringify.js:16:8:16:38 | require ... source) |
91
91
| json-stringify.js:2:16:2:23 | source() | json-stringify.js:17:8:17:39 | require ... source) |
92
92
| json-stringify.js:2:16:2:23 | source() | json-stringify.js:18:8:18:40 | require ... source) |
93
+ | json-stringify.js:2:16:2:23 | source() | json-stringify.js:21:8:21:46 | new jso ... source) |
93
94
| json-stringify.js:3:15:3:22 | source() | json-stringify.js:8:8:8:31 | jsonStr ... (taint) |
94
95
| nested-props.js:4:13:4:20 | source() | nested-props.js:5:10:5:14 | obj.x |
95
96
| nested-props.js:9:18:9:25 | source() | nested-props.js:10:10:10:16 | obj.x.y |
Original file line number Diff line number Diff line change @@ -16,4 +16,7 @@ function foo() {
16
16
sink ( require ( "util" ) . inspect ( source ) ) ; // NOT OK
17
17
sink ( require ( "pretty-format" ) ( source ) ) ; // NOT OK
18
18
sink ( require ( "object-inspect" ) ( source ) ) ; // NOT OK
19
+
20
+ const json2csv = require ( 'json2csv' ) ;
21
+ sink ( new json2csv . Parser ( opts ) . parse ( source ) ) ; // NOT OK
19
22
}
You can’t perform that action at this time.
0 commit comments