@@ -518,6 +518,22 @@ private module Stdlib {
518
518
override string getFormat ( ) { result = "JSON" }
519
519
}
520
520
521
+ /**
522
+ * A call to `json.load`
523
+ * See https://docs.python.org/3/library/json.html#json.load
524
+ */
525
+ private class JsonLoadCall extends Decoding:: Range , DataFlow:: CallCfgNode {
526
+ JsonLoadCall ( ) { this = json ( ) .getMember ( "load" ) .getACall ( ) }
527
+
528
+ override predicate mayExecuteInput ( ) { none ( ) }
529
+
530
+ override DataFlow:: Node getAnInput ( ) { result in [ this .getArg ( 0 ) , this .getArgByName ( "fp" ) ] }
531
+
532
+ override DataFlow:: Node getOutput ( ) { result = this }
533
+
534
+ override string getFormat ( ) { result = "JSON" }
535
+ }
536
+
521
537
/**
522
538
* A call to `json.dumps`
523
539
* See https://docs.python.org/3/library/json.html#json.dumps
@@ -532,6 +548,24 @@ private module Stdlib {
532
548
override string getFormat ( ) { result = "JSON" }
533
549
}
534
550
551
+ /**
552
+ * A call to `json.dump`
553
+ * See https://docs.python.org/3/library/json.html#json.dump
554
+ */
555
+ private class JsonDumpCall extends Encoding:: Range , DataFlow:: CallCfgNode {
556
+ JsonDumpCall ( ) { this = json ( ) .getMember ( "dump" ) .getACall ( ) }
557
+
558
+ override DataFlow:: Node getAnInput ( ) { result in [ this .getArg ( 0 ) , this .getArgByName ( "obj" ) ] }
559
+
560
+ override DataFlow:: Node getOutput ( ) {
561
+ result .( DataFlow:: PostUpdateNode ) .getPreUpdateNode ( ) in [
562
+ this .getArg ( 1 ) , this .getArgByName ( "fp" )
563
+ ]
564
+ }
565
+
566
+ override string getFormat ( ) { result = "JSON" }
567
+ }
568
+
535
569
// ---------------------------------------------------------------------------
536
570
// cgi
537
571
// ---------------------------------------------------------------------------
0 commit comments