@@ -134,44 +134,43 @@ module NetHttp {
134
134
result = call .getReceiver ( )
135
135
}
136
136
137
- private class ResponseBody extends Http:: ResponseBody:: Range , DataFlow :: Node {
137
+ private class ResponseBody extends Http:: ResponseBody:: Range {
138
138
DataFlow:: Node responseWriter ;
139
139
140
140
ResponseBody ( ) {
141
- this = any ( DataFlow:: CallNode call ) .getASyntacticArgument ( ) and
142
- (
143
- exists ( DataFlow:: CallNode call |
144
- // A direct call to ResponseWriter.Write, conveying taint from the argument to the receiver
145
- call .getTarget ( ) .( Method ) .implements ( "net/http" , "ResponseWriter" , "Write" ) and
146
- this = call .getArgument ( 0 ) and
147
- responseWriter = call .( DataFlow:: MethodCallNode ) .getReceiver ( )
148
- )
149
- or
150
- exists ( TaintTracking:: FunctionModel model |
151
- // A modeled function conveying taint from some input to the response writer,
152
- // e.g. `io.Copy(responseWriter, someTaintedReader)`
153
- model .taintStep ( this , responseWriter ) and
154
- responseWriter .getType ( ) .implements ( "net/http" , "ResponseWriter" )
155
- )
156
- or
157
- exists (
158
- SummarizedCallable callable , DataFlow:: CallNode call , SummaryComponentStack input ,
159
- SummaryComponentStack output
160
- |
161
- callable = call .getACalleeIncludingExternals ( ) and
162
- callable .propagatesFlow ( input , output , _)
163
- |
164
- // A modeled function conveying taint from some input to the response writer,
165
- // e.g. `io.Copy(responseWriter, someTaintedReader)`
166
- // NB. SummarizedCallables do not implement a direct call-site-crossing flow step; instead
167
- // they are implemented by a function body with internal dataflow nodes, so we mimic the
168
- // one-step style for the particular case of taint propagation direct from an argument or receiver
169
- // to another argument, receiver or return value, matching the behavior for a `TaintTracking::FunctionModel`.
170
- this = getSummaryInputOrOutputNode ( call , input ) and
171
- responseWriter .( DataFlow:: PostUpdateNode ) .getPreUpdateNode ( ) =
172
- getSummaryInputOrOutputNode ( call , output ) and
173
- responseWriter .getType ( ) .implements ( "net/http" , "ResponseWriter" )
174
- )
141
+ exists ( DataFlow:: CallNode call |
142
+ // A direct call to ResponseWriter.Write, conveying taint from the argument to the receiver
143
+ call .getTarget ( ) .( Method ) .implements ( "net/http" , "ResponseWriter" , "Write" ) and
144
+ this = call .getArgument ( 0 ) and
145
+ responseWriter = call .( DataFlow:: MethodCallNode ) .getReceiver ( )
146
+ )
147
+ or
148
+ exists ( TaintTracking:: FunctionModel model |
149
+ // A modeled function conveying taint from some input to the response writer,
150
+ // e.g. `io.Copy(responseWriter, someTaintedReader)`
151
+ this = model .getACall ( ) .getASyntacticArgument ( ) and
152
+ model .taintStep ( this , responseWriter ) and
153
+ responseWriter .getType ( ) .implements ( "net/http" , "ResponseWriter" )
154
+ )
155
+ or
156
+ exists (
157
+ SummarizedCallable callable , DataFlow:: CallNode call , SummaryComponentStack input ,
158
+ SummaryComponentStack output
159
+ |
160
+ this = call .getASyntacticArgument ( ) and
161
+ callable = call .getACalleeIncludingExternals ( ) and
162
+ callable .propagatesFlow ( input , output , _)
163
+ |
164
+ // A modeled function conveying taint from some input to the response writer,
165
+ // e.g. `io.Copy(responseWriter, someTaintedReader)`
166
+ // NB. SummarizedCallables do not implement a direct call-site-crossing flow step; instead
167
+ // they are implemented by a function body with internal dataflow nodes, so we mimic the
168
+ // one-step style for the particular case of taint propagation direct from an argument or receiver
169
+ // to another argument, receiver or return value, matching the behavior for a `TaintTracking::FunctionModel`.
170
+ this = getSummaryInputOrOutputNode ( call , input ) and
171
+ responseWriter .( DataFlow:: PostUpdateNode ) .getPreUpdateNode ( ) =
172
+ getSummaryInputOrOutputNode ( call , output ) and
173
+ responseWriter .getType ( ) .implements ( "net/http" , "ResponseWriter" )
175
174
)
176
175
}
177
176
0 commit comments