Skip to content

Commit 76508d1

Browse files
Jami CogswellJami Cogswell
authored andcommitted
Go/Swift: validate source/sink kinds
1 parent 254e447 commit 76508d1

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,16 @@ module ModelValidation {
194194
not kind instanceof ValidSummaryKind and
195195
result = "Invalid kind \"" + kind + "\" in summary model."
196196
)
197+
or
198+
exists(string kind | sinkModel(_, _, _, _, _, _, _, kind, _) |
199+
not kind instanceof ValidSinkKind and
200+
result = "Invalid kind \"" + kind + "\" in sink model."
201+
)
202+
or
203+
exists(string kind | sourceModel(_, _, _, _, _, _, _, kind, _) |
204+
not kind instanceof ValidSourceKind and
205+
result = "Invalid kind \"" + kind + "\" in source model."
206+
)
197207
}
198208

199209
private string getInvalidModelSignature() {

swift/ql/lib/codeql/swift/dataflow/ExternalFlow.qll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,16 @@ module CsvValidation {
270270
not kind instanceof ValidSummaryKind and
271271
result = "Invalid kind \"" + kind + "\" in summary model."
272272
)
273+
or
274+
exists(string kind | sinkModel(_, _, _, _, _, _, _, kind, _) |
275+
not kind instanceof ValidSinkKind and
276+
result = "Invalid kind \"" + kind + "\" in sink model."
277+
)
278+
or
279+
exists(string kind | sourceModel(_, _, _, _, _, _, _, kind, _) |
280+
not kind instanceof ValidSourceKind and
281+
result = "Invalid kind \"" + kind + "\" in source model."
282+
)
273283
}
274284

275285
private string getInvalidModelSubtype() {

0 commit comments

Comments
 (0)