Simplify net/http ResponseBody logic

This commit is contained in:
Sauyon Lee
2020-11-05 21:38:52 -08:00
committed by Chris Smowton
parent 8a306af77b
commit a78c35b95e

View File

@@ -145,16 +145,10 @@ module NetHttp {
responseWriter = call.(DataFlow::MethodCallNode).getReceiver()
)
or
exists(
TaintTracking::FunctionModel model, FunctionOutput modelOutput, FunctionInput modelInput,
DataFlow::CallNode call
|
exists(TaintTracking::FunctionModel model |
// A modelled function conveying taint from some input to the response writer,
// e.g. `io.Copy(responseWriter, someTaintedReader)`
call = model.getACall() and
model.hasTaintFlow(modelInput, modelOutput) and
this = modelInput.getNode(call) and
responseWriter = modelOutput.getNode(call).(DataFlow::PostUpdateNode).getPreUpdateNode() and
model.taintStep(this, responseWriter) and
responseWriter.getType().implements("net/http", "ResponseWriter")
)
}