Skip to content

Commit 81c6b77

Browse files
committed
Go: Adapt to changes in FlowSummaryImpl
1 parent 8d8e7c7 commit 81c6b77

File tree

2 files changed

+15
-36
lines changed

2 files changed

+15
-36
lines changed

go/ql/lib/semmle/go/dataflow/ExternalFlow.qll

Lines changed: 14 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -415,44 +415,23 @@ predicate sinkNode(DataFlow::Node node, string kind) { sinkNode(node, kind, _) }
415415

416416
// adapter class for converting Mad summaries to `SummarizedCallable`s
417417
private class SummarizedCallableAdapter extends Public::SummarizedCallable {
418-
SummarizedCallableAdapter() { summaryElement(this, _, _, _, _, _) }
418+
string input_;
419+
string output_;
420+
string kind;
421+
Public::Provenance p_;
422+
string model_;
419423

420-
private predicate relevantSummaryElementManual(
421-
string input, string output, string kind, string model
422-
) {
423-
exists(Public::Provenance provenance |
424-
summaryElement(this, input, output, kind, provenance, model) and
425-
provenance.isManual()
426-
)
427-
}
428-
429-
private predicate relevantSummaryElementGenerated(
430-
string input, string output, string kind, string model
431-
) {
432-
exists(Public::Provenance provenance |
433-
summaryElement(this, input, output, kind, provenance, model) and
434-
provenance.isGenerated()
435-
) and
436-
not exists(Public::Provenance provenance |
437-
neutralElement(this, "summary", provenance) and
438-
provenance.isManual()
439-
)
440-
}
424+
SummarizedCallableAdapter() { summaryElement(this, input_, output_, kind, p_, model_) }
441425

442426
override predicate propagatesFlow(
443-
string input, string output, boolean preservesValue, string model
427+
string input, string output, boolean preservesValue, Public::Provenance p, boolean isExact,
428+
string model
444429
) {
445-
exists(string kind |
446-
this.relevantSummaryElementManual(input, output, kind, model)
447-
or
448-
not this.relevantSummaryElementManual(_, _, _, _) and
449-
this.relevantSummaryElementGenerated(input, output, kind, model)
450-
|
451-
if kind = "value" then preservesValue = true else preservesValue = false
452-
)
453-
}
454-
455-
override predicate hasProvenance(Public::Provenance provenance) {
456-
summaryElement(this, _, _, _, provenance, _)
430+
input = input_ and
431+
output = output_ and
432+
(if kind = "value" then preservesValue = true else preservesValue = false) and
433+
p = p_ and
434+
isExact = true and
435+
model = model_
457436
}
458437
}

go/ql/lib/semmle/go/frameworks/stdlib/NetHttp.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ module NetHttp {
157157
|
158158
this = call.getASyntacticArgument() and
159159
callable = call.getACalleeIncludingExternals() and
160-
callable.propagatesFlow(input, output, _, _)
160+
callable.propagatesFlow(input, output, _, _, _, _)
161161
|
162162
// A modeled function conveying taint from some input to the response writer,
163163
// e.g. `io.Copy(responseWriter, someTaintedReader)`

0 commit comments

Comments
 (0)