Convert completetest to an inline flow test

This commit is contained in:
Owen Mansel-Chan
2021-11-23 21:17:58 -05:00
parent 8f7a34f9cb
commit a3df3614a5
3 changed files with 12 additions and 45 deletions

View File

@@ -1,39 +1,2 @@
failures
invalidModelRow
edges
| file://:0:0:0:0 | [summary] to write: array of return (return[0]) in StepArgResContent : interface type | file://:0:0:0:0 | [summary] to write: return (return[0]) in StepArgResContent [array] : interface type |
| file://:0:0:0:0 | parameter 0 of StepArgRes : interface type | file://:0:0:0:0 | [summary] to write: return (return[0]) in StepArgRes : interface type |
| file://:0:0:0:0 | parameter 0 of StepArgResContent : interface type | file://:0:0:0:0 | [summary] to write: array of return (return[0]) in StepArgResContent : interface type |
| test.go:51:9:51:16 | call to Src1 : interface type | test.go:53:24:53:26 | src : interface type |
| test.go:53:11:53:27 | call to StepArgRes : interface type | test.go:55:10:55:14 | taint |
| test.go:53:24:53:26 | src : interface type | file://:0:0:0:0 | parameter 0 of StepArgRes : interface type |
| test.go:53:24:53:26 | src : interface type | test.go:53:11:53:27 | call to StepArgRes : interface type |
| test.go:62:9:62:16 | call to Src1 : interface type | test.go:64:34:64:36 | src : interface type |
| test.go:64:11:64:37 | call to StepArgResContent [array] : interface type | test.go:66:10:66:14 | taint [array] : interface type |
| test.go:64:34:64:36 | src : interface type | file://:0:0:0:0 | parameter 0 of StepArgResContent : interface type |
| test.go:64:34:64:36 | src : interface type | test.go:64:11:64:37 | call to StepArgResContent [array] : interface type |
| test.go:66:10:66:14 | taint [array] : interface type | test.go:66:10:66:17 | index expression |
| test.go:73:9:73:16 | call to Src1 : interface type | test.go:78:10:78:17 | index expression |
nodes
| file://:0:0:0:0 | [summary] to write: array of return (return[0]) in StepArgResContent : interface type | semmle.label | [summary] to write: array of return (return[0]) in StepArgResContent : interface type |
| file://:0:0:0:0 | [summary] to write: return (return[0]) in StepArgRes : interface type | semmle.label | [summary] to write: return (return[0]) in StepArgRes : interface type |
| file://:0:0:0:0 | [summary] to write: return (return[0]) in StepArgResContent [array] : interface type | semmle.label | [summary] to write: return (return[0]) in StepArgResContent [array] : interface type |
| file://:0:0:0:0 | parameter 0 of StepArgRes : interface type | semmle.label | parameter 0 of StepArgRes : interface type |
| file://:0:0:0:0 | parameter 0 of StepArgResContent : interface type | semmle.label | parameter 0 of StepArgResContent : interface type |
| test.go:51:9:51:16 | call to Src1 : interface type | semmle.label | call to Src1 : interface type |
| test.go:53:11:53:27 | call to StepArgRes : interface type | semmle.label | call to StepArgRes : interface type |
| test.go:53:24:53:26 | src : interface type | semmle.label | src : interface type |
| test.go:55:10:55:14 | taint | semmle.label | taint |
| test.go:62:9:62:16 | call to Src1 : interface type | semmle.label | call to Src1 : interface type |
| test.go:64:11:64:37 | call to StepArgResContent [array] : interface type | semmle.label | call to StepArgResContent [array] : interface type |
| test.go:64:34:64:36 | src : interface type | semmle.label | src : interface type |
| test.go:66:10:66:14 | taint [array] : interface type | semmle.label | taint [array] : interface type |
| test.go:66:10:66:17 | index expression | semmle.label | index expression |
| test.go:73:9:73:16 | call to Src1 : interface type | semmle.label | call to Src1 : interface type |
| test.go:78:10:78:17 | index expression | semmle.label | index expression |
subpaths
| test.go:53:24:53:26 | src : interface type | file://:0:0:0:0 | parameter 0 of StepArgRes : interface type | file://:0:0:0:0 | [summary] to write: return (return[0]) in StepArgRes : interface type | test.go:53:11:53:27 | call to StepArgRes : interface type |
| test.go:64:34:64:36 | src : interface type | file://:0:0:0:0 | parameter 0 of StepArgResContent : interface type | file://:0:0:0:0 | [summary] to write: return (return[0]) in StepArgResContent [array] : interface type | test.go:64:11:64:37 | call to StepArgResContent [array] : interface type |
#select
| test.go:51:9:51:16 | call to Src1 : interface type | test.go:51:9:51:16 | call to Src1 : interface type | test.go:55:10:55:14 | taint | path |
| test.go:62:9:62:16 | call to Src1 : interface type | test.go:62:9:62:16 | call to Src1 : interface type | test.go:66:10:66:17 | index expression | path |
| test.go:73:9:73:16 | call to Src1 : interface type | test.go:73:9:73:16 | call to Src1 : interface type | test.go:78:10:78:17 | index expression | path |

View File

@@ -7,7 +7,7 @@ import semmle.go.dataflow.DataFlow
import semmle.go.dataflow.ExternalFlow
import semmle.go.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl
import CsvValidation
import DataFlow::PathGraph
import TestUtilities.InlineFlowTest
class SummaryModelTest extends SummaryModelCsv {
override predicate row(string row) {
@@ -48,6 +48,10 @@ class Config extends TaintTracking::Configuration {
override predicate isSink(DataFlow::Node src) { sinkNode(src, "qltest") }
}
from Config cfg, DataFlow::PathNode src, DataFlow::PathNode sink
where cfg.hasFlowPath(src, sink)
select src, src, sink, "path"
class ExternalFlowTest extends InlineFlowTest {
override DataFlow::Configuration getValueFlowConfig() { none() }
override DataFlow::Configuration getTaintFlowConfig() {
result = any(Config config)
}
}

View File

@@ -52,7 +52,7 @@ func simpleflow() {
taint := t.StepArgRes(src)
b.Sink1(taint)
b.Sink1(taint) // $ hasTaintFlow="taint"
}
func simpleflow1() {
@@ -63,7 +63,7 @@ func simpleflow1() {
taint := test.StepArgResContent(src)
b.Sink1(taint[0])
b.Sink1(taint[0]) // $ hasTaintFlow="index expression"
}
func contentflow() {
@@ -75,5 +75,5 @@ func contentflow() {
slice := make([]interface{}, 0)
slice = append(slice, src)
b.Sink1(slice[0])
b.Sink1(slice[0]) // $ hasTaintFlow="index expression"
}