Skip to content

Commit c816412

Browse files
committed
Create copy of ExternalTaintFlow called ExternalValueFlow
1 parent 84b7319 commit c816412

File tree

16 files changed

+433
-0
lines changed

16 files changed

+433
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
invalidModelRow
2+
testFailures
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
extensions:
2+
- addsTo:
3+
pack: codeql/go-all
4+
extensible: summaryModel
5+
data:
6+
- ["github.com/nonexistent/test", "T", False, "StepArgRes", "", "", "Argument[0]", "ReturnValue", "taint", "manual"]
7+
- ["github.com/nonexistent/test", "T", False, "StepArgRes1", "", "", "Argument[0]", "ReturnValue[1]", "taint", "manual"]
8+
- ["github.com/nonexistent/test", "T", False, "StepArgArg", "", "", "Argument[0]", "Argument[1]", "taint", "manual"]
9+
- ["github.com/nonexistent/test", "T", False, "StepArgQual", "", "", "Argument[0]", "Argument[-1]", "taint", "manual"]
10+
- ["github.com/nonexistent/test", "T", False, "StepQualRes", "", "", "Argument[-1]", "ReturnValue", "taint", "manual"]
11+
- ["github.com/nonexistent/test", "T", False, "StepQualArg", "", "", "Argument[-1]", "Argument[0]", "taint", "manual"]
12+
- ["github.com/nonexistent/test", "", False, "StepArgResNoQual", "", "", "Argument[0]", "ReturnValue", "taint", "manual"]
13+
- ["github.com/nonexistent/test", "", False, "StepArgResArrayContent", "", "", "Argument[0]", "ReturnValue.ArrayElement", "taint", "manual"]
14+
- ["github.com/nonexistent/test", "", False, "StepArgArrayContentRes", "", "", "Argument[0].ArrayElement", "ReturnValue", "taint", "manual"]
15+
- ["github.com/nonexistent/test", "", False, "StepArgResCollectionContent", "", "", "Argument[0]", "ReturnValue.Element", "taint", "manual"]
16+
- ["github.com/nonexistent/test", "", False, "StepArgCollectionContentRes", "", "", "Argument[0].Element", "ReturnValue", "taint", "manual"]
17+
- ["github.com/nonexistent/test", "", False, "StepArgResMapKeyContent", "", "", "Argument[0]", "ReturnValue.MapKey", "taint", "manual"]
18+
- ["github.com/nonexistent/test", "", False, "StepArgMapKeyContentRes", "", "", "Argument[0].MapKey", "ReturnValue", "taint", "manual"]
19+
- ["github.com/nonexistent/test", "", False, "StepArgResMapValueContent", "", "", "Argument[0]", "ReturnValue.MapValue", "taint", "manual"]
20+
- ["github.com/nonexistent/test", "", False, "StepArgMapValueContentRes", "", "", "Argument[0].MapValue", "ReturnValue", "taint", "manual"]
21+
- ["github.com/nonexistent/test", "", False, "GetElement", "", "", "Argument[0].Element", "ReturnValue", "value", "manual"]
22+
- ["github.com/nonexistent/test", "", False, "GetMapKey", "", "", "Argument[0].MapKey", "ReturnValue", "value", "manual"]
23+
- ["github.com/nonexistent/test", "", False, "SetElement", "", "", "Argument[0]", "ReturnValue.Element", "value", "manual"]
24+
- ["github.com/nonexistent/test", "C", False, "Get", "", "", "Argument[-1].Field[github.com/nonexistent/test.C.F]", "ReturnValue", "value", "manual"]
25+
- ["github.com/nonexistent/test", "C", False, "GetThroughPointer", "", "", "Argument[-1].Dereference.Field[github.com/nonexistent/test.C.F]", "ReturnValue", "value", "manual"]
26+
- ["github.com/nonexistent/test", "C", False, "Set", "", "", "Argument[0]", "Argument[-1].Field[github.com/nonexistent/test.C.F]", "value", "manual"]
27+
- ["github.com/nonexistent/test", "C", False, "SetThroughPointer", "", "", "Argument[0]", "Argument[-1].Dereference.Field[github.com/nonexistent/test.C.F]", "value", "manual"]
28+
29+
- addsTo:
30+
pack: codeql/go-all
31+
extensible: sourceModel
32+
data:
33+
- ["github.com/nonexistent/test", "A", False, "Src1", "", "", "ReturnValue", "qltest", "manual"]
34+
35+
- addsTo:
36+
pack: codeql/go-all
37+
extensible: sinkModel
38+
data:
39+
- ["github.com/nonexistent/test", "B", False, "Sink1", "", "", "Argument[0]", "qltest", "manual"]
40+
- ["github.com/nonexistent/test", "B", False, "SinkManyArgs", "", "", "Argument[0..2]", "qltest", "manual"]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* @kind path-problem
3+
*/
4+
5+
import go
6+
import semmle.go.dataflow.ExternalFlow
7+
import ModelValidation
8+
import semmle.go.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl
9+
import TestUtilities.InlineFlowTest
10+
11+
module Config implements DataFlow::ConfigSig {
12+
predicate isSource(DataFlow::Node src) { sourceNode(src, "qltest") }
13+
14+
predicate isSink(DataFlow::Node src) { sinkNode(src, "qltest") }
15+
}
16+
17+
import TaintFlowTest<Config>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module semmle.go.Packages
2+
3+
go 1.13
4+
5+
require github.com/nonexistent/test v0.0.0-20200203000000-0000000000000
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
invalidModelRow
2+
#select
3+
| test.go:47:10:47:12 | arg | qltest |
4+
| test.go:48:2:48:13 | type assertion | qltest |
5+
| test.go:61:10:61:15 | taint1 | qltest |
6+
| test.go:64:10:64:15 | taint2 | qltest |
7+
| test.go:68:10:68:15 | taint3 | qltest |
8+
| test.go:72:10:72:15 | taint4 | qltest |
9+
| test.go:75:10:75:15 | taint5 | qltest |
10+
| test.go:79:10:79:15 | taint6 | qltest |
11+
| test.go:82:10:82:15 | taint7 | qltest |
12+
| test.go:85:10:85:18 | index expression | qltest |
13+
| test.go:89:10:89:15 | taint9 | qltest |
14+
| test.go:92:10:92:33 | call to GetElement | qltest |
15+
| test.go:93:10:93:18 | <-... | qltest |
16+
| test.go:97:10:97:16 | taint11 | qltest |
17+
| test.go:100:10:100:32 | call to GetMapKey | qltest |
18+
| test.go:102:11:102:11 | k | qltest |
19+
| test.go:105:11:105:11 | k | qltest |
20+
| test.go:110:10:110:16 | taint13 | qltest |
21+
| test.go:113:10:113:20 | index expression | qltest |
22+
| test.go:117:10:117:16 | taint15 | qltest |
23+
| test.go:121:10:121:17 | index expression | qltest |
24+
| test.go:126:10:126:16 | taint16 | qltest |
25+
| test.go:130:10:130:13 | selection of F | qltest |
26+
| test.go:133:10:133:17 | call to Get | qltest |
27+
| test.go:137:10:137:17 | call to Get | qltest |
28+
| test.go:142:10:142:17 | call to Get | qltest |
29+
| test.go:146:10:146:14 | selection of F | qltest |
30+
| test.go:149:10:149:32 | call to GetThroughPointer | qltest |
31+
| test.go:153:10:153:32 | call to GetThroughPointer | qltest |
32+
| test.go:158:10:158:32 | call to GetThroughPointer | qltest |
33+
| test.go:164:17:164:20 | arg1 | qltest |
34+
| test.go:164:23:164:26 | arg2 | qltest |
35+
| test.go:164:29:164:32 | arg3 | qltest |
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
extensions:
2+
- addsTo:
3+
pack: codeql/go-all
4+
extensible: sinkModel
5+
data:
6+
- ["github.com/nonexistent/test", "B", False, "Sink1", "", "", "Argument[0]", "qltest", "manual"]
7+
- ["github.com/nonexistent/test", "B", False, "SinkMethod", "", "", "Argument[-1]", "qltest", "manual"]
8+
- ["github.com/nonexistent/test", "B", False, "SinkManyArgs", "", "", "Argument[0..2]", "qltest", "manual"]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import go
2+
import semmle.go.dataflow.ExternalFlow
3+
import ModelValidation
4+
5+
from DataFlow::Node node, string kind
6+
where sinkNode(node, kind)
7+
select node, kind
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
invalidModelRow
2+
#select
3+
| test.go:10:6:10:8 | definition of arg | qltest-arg |
4+
| test.go:38:8:38:15 | call to Src1 | qltest |
5+
| test.go:39:8:39:15 | call to Src2 | qltest |
6+
| test.go:39:8:39:15 | call to Src2 | qltest-w-subtypes |
7+
| test.go:40:8:40:16 | call to Src2 | qltest-w-subtypes |
8+
| test.go:41:2:41:21 | ... = ...[0] | qltest |
9+
| test.go:41:2:41:21 | ... = ...[1] | qltest-w-subtypes |
10+
| test.go:42:2:42:22 | ... = ...[1] | qltest-w-subtypes |
11+
| test.go:58:9:58:16 | call to Src1 | qltest |
12+
| test.go:91:46:91:53 | call to Src1 | qltest |
13+
| test.go:95:35:95:42 | call to Src1 | qltest |
14+
| test.go:99:42:99:49 | call to Src1 | qltest |
15+
| test.go:124:8:124:15 | call to Src1 | qltest |
16+
| test.go:129:9:129:16 | call to Src1 | qltest |
17+
| test.go:132:15:132:22 | call to Src1 | qltest |
18+
| test.go:136:9:136:16 | call to Src1 | qltest |
19+
| test.go:140:9:140:16 | call to Src1 | qltest |
20+
| test.go:145:24:145:31 | call to Src1 | qltest |
21+
| test.go:148:17:148:24 | call to Src1 | qltest |
22+
| test.go:152:24:152:31 | call to Src1 | qltest |
23+
| test.go:156:24:156:31 | call to Src1 | qltest |
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
extensions:
2+
- addsTo:
3+
pack: codeql/go-all
4+
extensible: sourceModel
5+
data:
6+
- ["github.com/nonexistent/test", "A", False, "Src1", "", "", "ReturnValue", "qltest", "manual"]
7+
- ["github.com/nonexistent/test", "A", False, "Src2", "", "", "ReturnValue", "qltest", "manual"]
8+
- ["github.com/nonexistent/test", "A", True, "Src2", "", "", "ReturnValue", "qltest-w-subtypes", "manual"]
9+
- ["github.com/nonexistent/test", "A", False, "SrcArg", "", "", "Argument[0]", "qltest-arg", "manual"]
10+
- ["github.com/nonexistent/test", "A", False, "Src3", "", "", "ReturnValue[0]", "qltest", "manual"]
11+
- ["github.com/nonexistent/test", "A", True, "Src3", "", "", "ReturnValue[1]", "qltest-w-subtypes", "manual"]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import go
2+
import semmle.go.dataflow.ExternalFlow
3+
import ModelValidation
4+
5+
from DataFlow::Node node, string kind
6+
where sourceNode(node, kind)
7+
select node, kind

0 commit comments

Comments
 (0)