@@ -14,7 +14,7 @@ import semmle.python.ApiGraphs
1414 */
1515module Gradio {
1616 /**
17- * The event handlers in Gradio , which take untrusted data.
17+ * The event handlers, Interface and gradio.ChatInterface classes , which take untrusted data.
1818 */
1919 class GradioInput extends API:: CallNode {
2020 GradioInput ( ) {
@@ -36,15 +36,8 @@ module Gradio {
3636 "upload" , "release" , "select" , "stream" , "like" , "load" , "key_up" ,
3737 ] )
3838 .getACall ( )
39- }
40- }
4139
42- /**
43- * The high-level gradio.Interface and gradio.ChatInterface classes, which take untrusted data.
44- */
45- class GradioInterface extends API:: CallNode {
46- GradioInterface ( ) {
47- this = API:: moduleImport ( "gradio" ) .getMember ( [ "Interface" , "ChatInterface" ] ) .getACall ( )
40+ or this = API:: moduleImport ( "gradio" ) .getMember ( [ "Interface" , "ChatInterface" ] ) .getACall ( )
4841 }
4942 }
5043
@@ -55,11 +48,8 @@ module Gradio {
5548 class GradioInputList extends RemoteFlowSource:: Range {
5649 GradioInputList ( ) {
5750 exists ( API:: CallNode call |
58- (
59- call instanceof GradioInput
60- or
61- call instanceof GradioInterface
62- ) and
51+ call instanceof GradioInput
52+ and
6353 // limit only to lists of parameters given to `inputs`.
6454 (
6555 (
@@ -85,11 +75,8 @@ module Gradio {
8575 class GradioInputParameter extends RemoteFlowSource:: Range {
8676 GradioInputParameter ( ) {
8777 exists ( API:: CallNode call |
88- (
89- call instanceof GradioInput
90- or
91- call instanceof GradioInterface
92- ) and
78+ call instanceof GradioInput
79+ and
9380 this = call .getParameter ( 0 , "fn" ) .getParameter ( _) .asSource ( ) and
9481 // exclude lists of parameters given to `inputs`
9582 not call .getKeywordParameter ( "inputs" ) .asSink ( ) .asCfgNode ( ) instanceof ListNode and
@@ -106,7 +93,7 @@ module Gradio {
10693 class GradioInputDecorator extends RemoteFlowSource:: Range {
10794 GradioInputDecorator ( ) {
10895 exists ( API:: CallNode call |
109- ( call instanceof GradioInput or call instanceof GradioInterface ) and
96+ call instanceof GradioInput and
11097 this = call .getReturn ( ) .getACall ( ) .getParameter ( 0 ) .getParameter ( _) .asSource ( )
11198 )
11299 }
@@ -120,11 +107,8 @@ module Gradio {
120107 private class ListTaintStep extends TaintTracking:: AdditionalTaintStep {
121108 override predicate step ( DataFlow:: Node nodeFrom , DataFlow:: Node nodeTo ) {
122109 exists ( API:: CallNode node |
123- (
124- node instanceof GradioInput
125- or
126- node instanceof GradioInterface
127- ) and
110+ node instanceof GradioInput
111+ and
128112 // handle cases where there are multiple arguments passed as a list to `inputs`
129113 (
130114 (
0 commit comments