Skip to content

Commit c468304

Browse files
committed
C#/Go/Java: Update expected output.
1 parent 93e9834 commit c468304

9 files changed

Lines changed: 21 additions & 10 deletions

File tree

‎csharp/ql/test/library-tests/controlflow/guards-large/GuardedExpr.expected‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
| GuardsStressTest.cs:8:26:8:27 | access to field ch |
2+
| GuardsStressTest.cs:9:4:9:5 | access to field ch |
23
| GuardsStressTest.cs:9:17:9:18 | access to field ch |
4+
| GuardsStressTest.cs:10:4:10:5 | access to field ch |
35
| GuardsStressTest.cs:11:4:11:5 | access to field ch |
46
| GuardsStressTest.cs:11:17:11:18 | access to field ch |
57
| GuardsStressTest.cs:12:4:12:5 | access to field ch |
@@ -791,4 +793,5 @@
791793
| GuardsStressTest.cs:438:19:438:20 | access to field ch |
792794
| GuardsStressTest.cs:439:4:439:5 | access to field ch |
793795
| GuardsStressTest.cs:439:19:439:20 | access to field ch |
796+
| GuardsStressTest.cs:439:41:439:42 | access to field ch |
794797
| GuardsStressTest.cs:440:23:440:24 | access to field ch |

‎go/ql/test/experimental/CWE-942/CorsMisconfiguration.expected‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
| CorsMisconfiguration.go:53:4:53:44 | call to Set | access-control-allow-origin header is set to a user-defined value, and access-control-allow-credentials is set to `true` |
88
| CorsMisconfiguration.go:60:4:60:56 | call to Set | access-control-allow-origin header is set to a user-defined value, and access-control-allow-credentials is set to `true` |
99
| CorsMisconfiguration.go:67:5:67:57 | call to Set | access-control-allow-origin header is set to a user-defined value, and access-control-allow-credentials is set to `true` |
10-
| CorsMisconfiguration.go:130:7:130:63 | call to Set | access-control-allow-origin header is set to a user-defined value, and access-control-allow-credentials is set to `true` |
11-
| CorsMisconfiguration.go:143:5:143:57 | call to Set | access-control-allow-origin header is set to a user-defined value, and access-control-allow-credentials is set to `true` |
12-
| CorsMisconfiguration.go:158:5:158:57 | call to Set | access-control-allow-origin header is set to a user-defined value, and access-control-allow-credentials is set to `true` |
13-
| CorsMisconfiguration.go:173:6:173:58 | call to Set | access-control-allow-origin header is set to a user-defined value, and access-control-allow-credentials is set to `true` |
1410
| CorsMisconfiguration.go:224:5:224:57 | call to Set | access-control-allow-origin header is set to a user-defined value, and access-control-allow-credentials is set to `true` |
1511
| RsCors.go:11:21:11:59 | slice literal | access-control-allow-origin header is set to `null`, and access-control-allow-credentials is set to `true` |
1612
| RsCors.go:31:23:31:61 | slice literal | access-control-allow-origin header is set to `null`, and access-control-allow-credentials is set to `true` |

‎go/ql/test/experimental/CWE-942/CorsMisconfiguration.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func main() {
127127
if origin != "" && origin != "null" {
128128
if len(AccessControlAllowOrigins) == 0 ||
129129
AccessControlAllowOrigins[origin] {
130-
responseHeader.Set("Access-Control-Allow-Origin", origin) // $ SPURIOUS: Alert
130+
responseHeader.Set("Access-Control-Allow-Origin", origin)
131131
responseHeader.Set("Access-Control-Allow-Credentials", "true")
132132
}
133133
} else {
@@ -140,7 +140,7 @@ func main() {
140140
// OK-ish: the input origin header is validated against a suffix.
141141
origin := req.Header.Get("Origin")
142142
if origin != "" && (originSuffix == "" || strings.HasSuffix(origin, originSuffix)) {
143-
w.Header().Set("Access-Control-Allow-Origin", origin) // $ SPURIOUS: Alert
143+
w.Header().Set("Access-Control-Allow-Origin", origin)
144144
w.Header().Set("Access-Control-Allow-Credentials", "true")
145145
w.Header().Set("Access-Control-Allow-Headers", "Content-Type, x-requested-by, *")
146146
w.Header().Set("Access-Control-Allow-Methods", "GET, PUT, POST, DELETE, OPTIONS")
@@ -155,7 +155,7 @@ func main() {
155155
// OK-ish: the input origin header is validated against a whitelist.
156156
origin := req.Header.Get("Origin")
157157
if origin != "" && (originSuffix == "" || AccessControlAllowOrigins[origin]) {
158-
w.Header().Set("Access-Control-Allow-Origin", origin) // $ SPURIOUS: Alert
158+
w.Header().Set("Access-Control-Allow-Origin", origin)
159159
w.Header().Set("Access-Control-Allow-Credentials", "true")
160160
w.Header().Set("Access-Control-Allow-Headers", "Content-Type, x-requested-by, *")
161161
w.Header().Set("Access-Control-Allow-Methods", "GET, PUT, POST, DELETE, OPTIONS")
@@ -170,7 +170,7 @@ func main() {
170170
origin := req.Header.Get("origin")
171171
if origin != "" && origin != "null" {
172172
if len(AccessControlAllowOrigins) == 0 || AccessControlAllowOrigins[origin] {
173-
w.Header().Set("Access-Control-Allow-Origin", origin) // $ SPURIOUS: Alert
173+
w.Header().Set("Access-Control-Allow-Origin", origin)
174174
w.Header().Set("Access-Control-Allow-Credentials", "true")
175175
}
176176
} else {

‎go/ql/test/library-tests/semmle/go/controlflow/Guards/Guards.expected‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ controlsResult
1515
| guards.go:42:2:43:33 | case clause | tagged false comparison | true |
1616
| guards.go:42:7:42:17 | ...<... | tagged false comparison | false |
1717
| guards.go:48:5:48:5 | a | compound true | true |
18+
| guards.go:48:5:48:17 | ...&&... | compound false | false |
19+
| guards.go:48:5:48:17 | ...&&... | compound true | true |
20+
| guards.go:48:11:48:16 | ...\|\|... | compound true | true |
1821
| guards.go:56:5:56:20 | ...==... | upcast | true |
1922
| guards.go:59:5:59:19 | ...==... | downcast | true |
2023
| guards.go:62:5:62:22 | ...==... | upcast narrow | true |
@@ -83,6 +86,9 @@ valueControlsResult
8386
| guards.go:42:7:42:12 | number | tagged false comparison | Lower bound 10 |
8487
| guards.go:42:7:42:17 | ...<... | tagged false comparison | false |
8588
| guards.go:48:5:48:5 | a | compound true | true |
89+
| guards.go:48:5:48:17 | ...&&... | compound false | false |
90+
| guards.go:48:5:48:17 | ...&&... | compound true | true |
91+
| guards.go:48:11:48:16 | ...\|\|... | compound true | true |
8692
| guards.go:56:5:56:15 | type conversion | upcast | 0 |
8793
| guards.go:56:5:56:20 | ...==... | upcast | true |
8894
| guards.go:56:11:56:14 | wide | upcast | 0 |

‎java/ql/test-kotlin1/query-tests/UselessNullCheck/Test.kt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ fun fn(x:Any?, y: Any?) {
55

66
if (x != null) {
77
println("x not null")
8-
} else if (y != null) {
8+
} else if (y != null) { // $ Alert
99
println("y not null")
1010
}
1111
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
| Test.kt:8:16:8:24 | ... (value not-equals) ... | This check is useless. $@ cannot be null at this check, since it is guarded by $@. | Test.kt:8:16:8:16 | y | y | Test.kt:2:22:2:30 | ... (value equals) ... | ... (value equals) ... |
12
| Test.kt:15:12:15:21 | ... (value equals) ... | This check is useless. $@ cannot be null at this check, since it is guarded by $@. | Test.kt:15:9:15:9 | tmp0_safe_receiver | tmp0_safe_receiver | Test.kt:14:9:14:17 | ... (value not-equals) ... | ... (value not-equals) ... |

‎java/ql/test-kotlin2/query-tests/UselessNullCheck/Test.kt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ fun fn(x:Any?, y: Any?) {
55

66
if (x != null) {
77
println("x not null")
8-
} else if (y != null) {
8+
} else if (y != null) { // $ Alert
99
println("y not null")
1010
}
1111
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
| Test.kt:8:16:8:24 | ... (value not-equals) ... | This check is useless. $@ cannot be null at this check, since it is guarded by $@. | Test.kt:8:16:8:16 | y | y | Test.kt:2:22:2:30 | ... (value equals) ... | ... (value equals) ... |
12
| Test.kt:15:12:15:21 | ... (value equals) ... | This check is useless. $@ cannot be null at this check, since it is guarded by $@. | Test.kt:15:12:15:21 | tmp0_safe_receiver | tmp0_safe_receiver | Test.kt:14:9:14:17 | ... (value not-equals) ... | ... (value not-equals) ... |

‎java/ql/test/library-tests/guards/guardslogic.expected‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
| Logic.java:36:16:36:21 | g(...) | false | Logic.java:37:17:39:5 | { ... } |
4848
| Logic.java:36:16:36:21 | g(...) | false | Logic.java:40:5:40:18 | var ...; |
4949
| Logic.java:37:9:37:14 | ... > ... | true | Logic.java:37:17:39:5 | { ... } |
50+
| Logic.java:44:9:44:10 | !... | false | Logic.java:43:23:43:31 | Normal Exit |
51+
| Logic.java:44:9:44:10 | !... | true | Logic.java:44:33:44:35 | msg |
5052
| Logic.java:44:10:44:10 | b | false | Logic.java:44:33:44:35 | msg |
5153
| Logic.java:44:10:44:10 | b | true | Logic.java:43:23:43:31 | Normal Exit |
5254
| Logic.java:48:5:48:22 | checkTrue(...) | exception | Logic.java:47:23:47:32 | Exceptional Exit |
@@ -68,6 +70,8 @@
6870
| Logic.java:53:21:53:26 | g(...) | false | Logic.java:54:17:56:5 | { ... } |
6971
| Logic.java:53:21:53:26 | g(...) | false | Logic.java:57:5:57:18 | var ...; |
7072
| Logic.java:54:9:54:14 | ... > ... | true | Logic.java:54:17:56:5 | { ... } |
73+
| Logic.java:61:9:61:10 | !... | false | Logic.java:60:23:60:31 | Normal Exit |
74+
| Logic.java:61:9:61:10 | !... | true | Logic.java:61:33:61:35 | msg |
7175
| Logic.java:61:10:61:10 | b | false | Logic.java:61:33:61:35 | msg |
7276
| Logic.java:61:10:61:10 | b | true | Logic.java:60:23:60:31 | Normal Exit |
7377
| Logic.java:65:5:65:22 | checkTrue(...) | exception | Logic.java:64:23:64:32 | Exceptional Exit |

0 commit comments

Comments
 (0)