Skip to content

Commit 62ac0dc

Browse files
Jami CogswellJami Cogswell
authored andcommitted
Shared: add outdated sink kind msg to 'getInvalidModelKind' for all languages
1 parent 76f5dca commit 62ac0dc

File tree

6 files changed

+36
-12
lines changed

6 files changed

+36
-12
lines changed

csharp/ql/lib/semmle/code/csharp/dataflow/ExternalFlow.qll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,13 @@ module ModelValidation {
216216
result = "Invalid kind \"" + kind + "\" in sink model."
217217
)
218218
or
219-
exists(string kind | sourceModel(_, _, _, _, _, _, _, kind, _) |
219+
exists(string kind, string msg | sourceModel(_, _, _, _, _, _, _, kind, _) |
220220
not kind instanceof ValidSourceKind and
221-
result = "Invalid kind \"" + kind + "\" in source model."
221+
msg = "Invalid kind \"" + kind + "\" in sink model." and
222+
// The part of this message that refers to outdated sink kinds can be deleted after June 1st, 2024.
223+
if kind instanceof OutdatedSinkKind
224+
then result = msg + " " + kind.(OutdatedSinkKind).outdatedMessage()
225+
else result = msg
222226
)
223227
or
224228
exists(string kind | neutralModel(_, _, _, _, kind, _) |

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,13 @@ module ModelValidation {
195195
result = "Invalid kind \"" + kind + "\" in summary model."
196196
)
197197
or
198-
exists(string kind | sinkModel(_, _, _, _, _, _, _, kind, _) |
198+
exists(string kind, string msg | sinkModel(_, _, _, _, _, _, _, kind, _) |
199199
not kind instanceof ValidSinkKind and
200-
result = "Invalid kind \"" + kind + "\" in sink model."
200+
msg = "Invalid kind \"" + kind + "\" in sink model." and
201+
// The part of this message that refers to outdated sink kinds can be deleted after June 1st, 2024.
202+
if kind instanceof OutdatedSinkKind
203+
then result = msg + " " + kind.(OutdatedSinkKind).outdatedMessage()
204+
else result = msg
201205
)
202206
or
203207
exists(string kind | sourceModel(_, _, _, _, _, _, _, kind, _) |

javascript/ql/lib/semmle/javascript/frameworks/data/internal/ApiGraphModels.qll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,9 +661,13 @@ module ModelOutput {
661661
result = "Invalid kind \"" + kind + "\" in summary model."
662662
)
663663
or
664-
exists(string kind | sinkModel(_, _, kind) |
664+
exists(string kind, string msg | sinkModel(_, _, kind) |
665665
not kind instanceof ValidSinkKind and
666-
result = "Invalid kind \"" + kind + "\" in sink model."
666+
msg = "Invalid kind \"" + kind + "\" in sink model." and
667+
// The part of this message that refers to outdated sink kinds can be deleted after June 1st, 2024.
668+
if kind instanceof OutdatedSinkKind
669+
then result = msg + " " + kind.(OutdatedSinkKind).outdatedMessage()
670+
else result = msg
667671
)
668672
or
669673
exists(string kind | sourceModel(_, _, kind) |

python/ql/lib/semmle/python/frameworks/data/internal/ApiGraphModels.qll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,9 +661,13 @@ module ModelOutput {
661661
result = "Invalid kind \"" + kind + "\" in summary model."
662662
)
663663
or
664-
exists(string kind | sinkModel(_, _, kind) |
664+
exists(string kind, string msg | sinkModel(_, _, kind) |
665665
not kind instanceof ValidSinkKind and
666-
result = "Invalid kind \"" + kind + "\" in sink model."
666+
msg = "Invalid kind \"" + kind + "\" in sink model." and
667+
// The part of this message that refers to outdated sink kinds can be deleted after June 1st, 2024.
668+
if kind instanceof OutdatedSinkKind
669+
then result = msg + " " + kind.(OutdatedSinkKind).outdatedMessage()
670+
else result = msg
667671
)
668672
or
669673
exists(string kind | sourceModel(_, _, kind) |

ruby/ql/lib/codeql/ruby/frameworks/data/internal/ApiGraphModels.qll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,9 +661,13 @@ module ModelOutput {
661661
result = "Invalid kind \"" + kind + "\" in summary model."
662662
)
663663
or
664-
exists(string kind | sinkModel(_, _, kind) |
664+
exists(string kind, string msg | sinkModel(_, _, kind) |
665665
not kind instanceof ValidSinkKind and
666-
result = "Invalid kind \"" + kind + "\" in sink model."
666+
msg = "Invalid kind \"" + kind + "\" in sink model." and
667+
// The part of this message that refers to outdated sink kinds can be deleted after June 1st, 2024.
668+
if kind instanceof OutdatedSinkKind
669+
then result = msg + " " + kind.(OutdatedSinkKind).outdatedMessage()
670+
else result = msg
667671
)
668672
or
669673
exists(string kind | sourceModel(_, _, kind) |

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,13 @@ module CsvValidation {
271271
result = "Invalid kind \"" + kind + "\" in summary model."
272272
)
273273
or
274-
exists(string kind | sinkModel(_, _, _, _, _, _, _, kind, _) |
274+
exists(string kind, string msg | sinkModel(_, _, _, _, _, _, _, kind, _) |
275275
not kind instanceof ValidSinkKind and
276-
result = "Invalid kind \"" + kind + "\" in sink model."
276+
msg = "Invalid kind \"" + kind + "\" in sink model." and
277+
// The part of this message that refers to outdated sink kinds can be deleted after June 1st, 2024.
278+
if kind instanceof OutdatedSinkKind
279+
then result = msg + " " + kind.(OutdatedSinkKind).outdatedMessage()
280+
else result = msg
277281
)
278282
or
279283
exists(string kind | sourceModel(_, _, _, _, _, _, _, kind, _) |

0 commit comments

Comments
 (0)