Skip to content

Commit 27567e4

Browse files
committed
JS: Add angular.fromJson as JSON parser
1 parent 5aa948c commit 27567e4

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

javascript/ql/src/semmle/javascript/JsonParsers.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ private class PlainJsonParserCall extends JsonParserCall {
2828
callee = DataFlow::globalVarRef("JSON").getAPropertyRead("parse") or
2929
callee = DataFlow::moduleImport("parse-json") or
3030
callee = DataFlow::moduleImport("json-parse-better-errors") or
31-
callee = DataFlow::moduleImport("json-safe-parse")
31+
callee = DataFlow::moduleImport("json-safe-parse") or
32+
callee = AngularJS::angular().getAPropertyRead("fromJson")
3233
)
3334
}
3435

javascript/ql/test/library-tests/JsonParsers/JsonParserCalls.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
| angular.js:1:1:1:34 | checkJS ... input)) | OK |
12
| tst.js:11:1:11:28 | checkJS ... input)) | OK |
23
| tst.js:12:1:12:39 | checkJS ... input)) | OK |
34
| tst.js:13:1:13:53 | checkJS ... input)) | OK |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
checkJSON(angular.fromJson(input));

0 commit comments

Comments
 (0)