@@ -14,7 +14,7 @@ import semmle.python.ApiGraphs
14
14
*/
15
15
module Gradio {
16
16
/**
17
- * The event handlers in Gradio , which take untrusted data.
17
+ * The event handlers, Interface and gradio.ChatInterface classes , which take untrusted data.
18
18
*/
19
19
class GradioInput extends API:: CallNode {
20
20
GradioInput ( ) {
@@ -36,15 +36,8 @@ module Gradio {
36
36
"upload" , "release" , "select" , "stream" , "like" , "load" , "key_up" ,
37
37
] )
38
38
.getACall ( )
39
- }
40
- }
41
39
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 ( )
48
41
}
49
42
}
50
43
@@ -55,11 +48,8 @@ module Gradio {
55
48
class GradioInputList extends RemoteFlowSource:: Range {
56
49
GradioInputList ( ) {
57
50
exists ( API:: CallNode call |
58
- (
59
- call instanceof GradioInput
60
- or
61
- call instanceof GradioInterface
62
- ) and
51
+ call instanceof GradioInput
52
+ and
63
53
// limit only to lists of parameters given to `inputs`.
64
54
(
65
55
(
@@ -85,11 +75,8 @@ module Gradio {
85
75
class GradioInputParameter extends RemoteFlowSource:: Range {
86
76
GradioInputParameter ( ) {
87
77
exists ( API:: CallNode call |
88
- (
89
- call instanceof GradioInput
90
- or
91
- call instanceof GradioInterface
92
- ) and
78
+ call instanceof GradioInput
79
+ and
93
80
this = call .getParameter ( 0 , "fn" ) .getParameter ( _) .asSource ( ) and
94
81
// exclude lists of parameters given to `inputs`
95
82
not call .getKeywordParameter ( "inputs" ) .asSink ( ) .asCfgNode ( ) instanceof ListNode and
@@ -106,7 +93,7 @@ module Gradio {
106
93
class GradioInputDecorator extends RemoteFlowSource:: Range {
107
94
GradioInputDecorator ( ) {
108
95
exists ( API:: CallNode call |
109
- ( call instanceof GradioInput or call instanceof GradioInterface ) and
96
+ call instanceof GradioInput and
110
97
this = call .getReturn ( ) .getACall ( ) .getParameter ( 0 ) .getParameter ( _) .asSource ( )
111
98
)
112
99
}
@@ -120,11 +107,8 @@ module Gradio {
120
107
private class ListTaintStep extends TaintTracking:: AdditionalTaintStep {
121
108
override predicate step ( DataFlow:: Node nodeFrom , DataFlow:: Node nodeTo ) {
122
109
exists ( API:: CallNode node |
123
- (
124
- node instanceof GradioInput
125
- or
126
- node instanceof GradioInterface
127
- ) and
110
+ node instanceof GradioInput
111
+ and
128
112
// handle cases where there are multiple arguments passed as a list to `inputs`
129
113
(
130
114
(
0 commit comments