Skip to content

Commit 76f5dca

Browse files
Jami CogswellJami Cogswell
authored andcommitted
Shared: move 'OutdatedSinkKind' to shared file and add outdated JS and C# sink kinds
1 parent 7b629f5 commit 76f5dca

File tree

8 files changed

+322
-44
lines changed

8 files changed

+322
-44
lines changed

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

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,52 @@ class ValidSinkKind extends string {
4040
}
4141
}
4242

43+
class OutdatedSinkKind extends string {
44+
OutdatedSinkKind() {
45+
this =
46+
[
47+
"sql", "url-redirect", "xpath", "ssti", "logging", "groovy", "jexl", "mvel", "xslt", "ldap",
48+
"pending-intent-sent", "intent-start", "set-hostname-verifier", "header-splitting", "xss",
49+
"write-file", "create-file", "read-file", "open-url", "jdbc-url", "command-line-injection",
50+
"code", "html", "remote"
51+
]
52+
}
53+
54+
private string replacementKind() {
55+
this = ["sql", "xpath", "groovy", "jexl", "mvel", "xslt", "ldap", "code", "html"] and
56+
result = this + "-injection"
57+
or
58+
this = "url-redirect" and result = "url-redirection"
59+
or
60+
this = "ssti" and result = "template-injection"
61+
or
62+
this = "logging" and result = "log-injection"
63+
or
64+
this = "pending-intent-sent" and result = "pending-intents"
65+
or
66+
this = "intent-start" and result = "intent-redirection"
67+
or
68+
this = "set-hostname-verifier" and result = "hostname-verification"
69+
or
70+
this = "header-splitting" and result = "response-splitting"
71+
or
72+
this = "xss" and result = "html-injection\" or \"js-injection"
73+
or
74+
this = ["write-file", "remote"] and result = "file-content-store"
75+
or
76+
this = ["create-file", "read-file"] and result = "path-injection"
77+
or
78+
this = ["open-url", "jdbc-url"] and result = "request-forgery"
79+
or
80+
this = "command-line-injection" and result = "command-injection"
81+
}
82+
83+
string outdatedMessage() {
84+
result =
85+
"The kind \"" + this + "\" is outdated. Use \"" + this.replacementKind() + "\" instead."
86+
}
87+
}
88+
4389
/** A valid models-as-data source kind. */
4490
class ValidSourceKind extends string {
4591
bindingset[this]

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

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,52 @@ class ValidSinkKind extends string {
4040
}
4141
}
4242

43+
class OutdatedSinkKind extends string {
44+
OutdatedSinkKind() {
45+
this =
46+
[
47+
"sql", "url-redirect", "xpath", "ssti", "logging", "groovy", "jexl", "mvel", "xslt", "ldap",
48+
"pending-intent-sent", "intent-start", "set-hostname-verifier", "header-splitting", "xss",
49+
"write-file", "create-file", "read-file", "open-url", "jdbc-url", "command-line-injection",
50+
"code", "html", "remote"
51+
]
52+
}
53+
54+
private string replacementKind() {
55+
this = ["sql", "xpath", "groovy", "jexl", "mvel", "xslt", "ldap", "code", "html"] and
56+
result = this + "-injection"
57+
or
58+
this = "url-redirect" and result = "url-redirection"
59+
or
60+
this = "ssti" and result = "template-injection"
61+
or
62+
this = "logging" and result = "log-injection"
63+
or
64+
this = "pending-intent-sent" and result = "pending-intents"
65+
or
66+
this = "intent-start" and result = "intent-redirection"
67+
or
68+
this = "set-hostname-verifier" and result = "hostname-verification"
69+
or
70+
this = "header-splitting" and result = "response-splitting"
71+
or
72+
this = "xss" and result = "html-injection\" or \"js-injection"
73+
or
74+
this = ["write-file", "remote"] and result = "file-content-store"
75+
or
76+
this = ["create-file", "read-file"] and result = "path-injection"
77+
or
78+
this = ["open-url", "jdbc-url"] and result = "request-forgery"
79+
or
80+
this = "command-line-injection" and result = "command-injection"
81+
}
82+
83+
string outdatedMessage() {
84+
result =
85+
"The kind \"" + this + "\" is outdated. Use \"" + this.replacementKind() + "\" instead."
86+
}
87+
}
88+
4389
/** A valid models-as-data source kind. */
4490
class ValidSourceKind extends string {
4591
bindingset[this]

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

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -266,50 +266,6 @@ module ModelValidation {
266266
)
267267
}
268268

269-
private class OutdatedSinkKind extends string {
270-
OutdatedSinkKind() {
271-
this =
272-
[
273-
"sql", "url-redirect", "xpath", "ssti", "logging", "groovy", "jexl", "mvel", "xslt",
274-
"ldap", "pending-intent-sent", "intent-start", "set-hostname-verifier",
275-
"header-splitting", "xss", "write-file", "create-file", "read-file", "open-url",
276-
"jdbc-url"
277-
]
278-
}
279-
280-
private string replacementKind() {
281-
this = ["sql", "xpath", "groovy", "jexl", "mvel", "xslt", "ldap"] and
282-
result = this + "-injection"
283-
or
284-
this = "url-redirect" and result = "url-redirection"
285-
or
286-
this = "ssti" and result = "template-injection"
287-
or
288-
this = "logging" and result = "log-injection"
289-
or
290-
this = "pending-intent-sent" and result = "pending-intents"
291-
or
292-
this = "intent-start" and result = "intent-redirection"
293-
or
294-
this = "set-hostname-verifier" and result = "hostname-verification"
295-
or
296-
this = "header-splitting" and result = "response-splitting"
297-
or
298-
this = "xss" and result = "html-injection\" or \"js-injection"
299-
or
300-
this = "write-file" and result = "file-content-store"
301-
or
302-
this = ["create-file", "read-file"] and result = "path-injection"
303-
or
304-
this = ["open-url", "jdbc-url"] and result = "request-forgery"
305-
}
306-
307-
string outdatedMessage() {
308-
result =
309-
"The kind \"" + this + "\" is outdated. Use \"" + this.replacementKind() + "\" instead."
310-
}
311-
}
312-
313269
private string getInvalidModelKind() {
314270
exists(string kind | summaryModel(_, _, _, _, _, _, _, _, kind, _) |
315271
not kind instanceof ValidSummaryKind and

java/ql/lib/semmle/code/java/dataflow/SharedModelValidation.qll

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,52 @@ class ValidSinkKind extends string {
4040
}
4141
}
4242

43+
class OutdatedSinkKind extends string {
44+
OutdatedSinkKind() {
45+
this =
46+
[
47+
"sql", "url-redirect", "xpath", "ssti", "logging", "groovy", "jexl", "mvel", "xslt", "ldap",
48+
"pending-intent-sent", "intent-start", "set-hostname-verifier", "header-splitting", "xss",
49+
"write-file", "create-file", "read-file", "open-url", "jdbc-url", "command-line-injection",
50+
"code", "html", "remote"
51+
]
52+
}
53+
54+
private string replacementKind() {
55+
this = ["sql", "xpath", "groovy", "jexl", "mvel", "xslt", "ldap", "code", "html"] and
56+
result = this + "-injection"
57+
or
58+
this = "url-redirect" and result = "url-redirection"
59+
or
60+
this = "ssti" and result = "template-injection"
61+
or
62+
this = "logging" and result = "log-injection"
63+
or
64+
this = "pending-intent-sent" and result = "pending-intents"
65+
or
66+
this = "intent-start" and result = "intent-redirection"
67+
or
68+
this = "set-hostname-verifier" and result = "hostname-verification"
69+
or
70+
this = "header-splitting" and result = "response-splitting"
71+
or
72+
this = "xss" and result = "html-injection\" or \"js-injection"
73+
or
74+
this = ["write-file", "remote"] and result = "file-content-store"
75+
or
76+
this = ["create-file", "read-file"] and result = "path-injection"
77+
or
78+
this = ["open-url", "jdbc-url"] and result = "request-forgery"
79+
or
80+
this = "command-line-injection" and result = "command-injection"
81+
}
82+
83+
string outdatedMessage() {
84+
result =
85+
"The kind \"" + this + "\" is outdated. Use \"" + this.replacementKind() + "\" instead."
86+
}
87+
}
88+
4389
/** A valid models-as-data source kind. */
4490
class ValidSourceKind extends string {
4591
bindingset[this]

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

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,52 @@ class ValidSinkKind extends string {
4040
}
4141
}
4242

43+
class OutdatedSinkKind extends string {
44+
OutdatedSinkKind() {
45+
this =
46+
[
47+
"sql", "url-redirect", "xpath", "ssti", "logging", "groovy", "jexl", "mvel", "xslt", "ldap",
48+
"pending-intent-sent", "intent-start", "set-hostname-verifier", "header-splitting", "xss",
49+
"write-file", "create-file", "read-file", "open-url", "jdbc-url", "command-line-injection",
50+
"code", "html", "remote"
51+
]
52+
}
53+
54+
private string replacementKind() {
55+
this = ["sql", "xpath", "groovy", "jexl", "mvel", "xslt", "ldap", "code", "html"] and
56+
result = this + "-injection"
57+
or
58+
this = "url-redirect" and result = "url-redirection"
59+
or
60+
this = "ssti" and result = "template-injection"
61+
or
62+
this = "logging" and result = "log-injection"
63+
or
64+
this = "pending-intent-sent" and result = "pending-intents"
65+
or
66+
this = "intent-start" and result = "intent-redirection"
67+
or
68+
this = "set-hostname-verifier" and result = "hostname-verification"
69+
or
70+
this = "header-splitting" and result = "response-splitting"
71+
or
72+
this = "xss" and result = "html-injection\" or \"js-injection"
73+
or
74+
this = ["write-file", "remote"] and result = "file-content-store"
75+
or
76+
this = ["create-file", "read-file"] and result = "path-injection"
77+
or
78+
this = ["open-url", "jdbc-url"] and result = "request-forgery"
79+
or
80+
this = "command-line-injection" and result = "command-injection"
81+
}
82+
83+
string outdatedMessage() {
84+
result =
85+
"The kind \"" + this + "\" is outdated. Use \"" + this.replacementKind() + "\" instead."
86+
}
87+
}
88+
4389
/** A valid models-as-data source kind. */
4490
class ValidSourceKind extends string {
4591
bindingset[this]

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

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,52 @@ class ValidSinkKind extends string {
4040
}
4141
}
4242

43+
class OutdatedSinkKind extends string {
44+
OutdatedSinkKind() {
45+
this =
46+
[
47+
"sql", "url-redirect", "xpath", "ssti", "logging", "groovy", "jexl", "mvel", "xslt", "ldap",
48+
"pending-intent-sent", "intent-start", "set-hostname-verifier", "header-splitting", "xss",
49+
"write-file", "create-file", "read-file", "open-url", "jdbc-url", "command-line-injection",
50+
"code", "html", "remote"
51+
]
52+
}
53+
54+
private string replacementKind() {
55+
this = ["sql", "xpath", "groovy", "jexl", "mvel", "xslt", "ldap", "code", "html"] and
56+
result = this + "-injection"
57+
or
58+
this = "url-redirect" and result = "url-redirection"
59+
or
60+
this = "ssti" and result = "template-injection"
61+
or
62+
this = "logging" and result = "log-injection"
63+
or
64+
this = "pending-intent-sent" and result = "pending-intents"
65+
or
66+
this = "intent-start" and result = "intent-redirection"
67+
or
68+
this = "set-hostname-verifier" and result = "hostname-verification"
69+
or
70+
this = "header-splitting" and result = "response-splitting"
71+
or
72+
this = "xss" and result = "html-injection\" or \"js-injection"
73+
or
74+
this = ["write-file", "remote"] and result = "file-content-store"
75+
or
76+
this = ["create-file", "read-file"] and result = "path-injection"
77+
or
78+
this = ["open-url", "jdbc-url"] and result = "request-forgery"
79+
or
80+
this = "command-line-injection" and result = "command-injection"
81+
}
82+
83+
string outdatedMessage() {
84+
result =
85+
"The kind \"" + this + "\" is outdated. Use \"" + this.replacementKind() + "\" instead."
86+
}
87+
}
88+
4389
/** A valid models-as-data source kind. */
4490
class ValidSourceKind extends string {
4591
bindingset[this]

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

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,52 @@ class ValidSinkKind extends string {
4040
}
4141
}
4242

43+
class OutdatedSinkKind extends string {
44+
OutdatedSinkKind() {
45+
this =
46+
[
47+
"sql", "url-redirect", "xpath", "ssti", "logging", "groovy", "jexl", "mvel", "xslt", "ldap",
48+
"pending-intent-sent", "intent-start", "set-hostname-verifier", "header-splitting", "xss",
49+
"write-file", "create-file", "read-file", "open-url", "jdbc-url", "command-line-injection",
50+
"code", "html", "remote"
51+
]
52+
}
53+
54+
private string replacementKind() {
55+
this = ["sql", "xpath", "groovy", "jexl", "mvel", "xslt", "ldap", "code", "html"] and
56+
result = this + "-injection"
57+
or
58+
this = "url-redirect" and result = "url-redirection"
59+
or
60+
this = "ssti" and result = "template-injection"
61+
or
62+
this = "logging" and result = "log-injection"
63+
or
64+
this = "pending-intent-sent" and result = "pending-intents"
65+
or
66+
this = "intent-start" and result = "intent-redirection"
67+
or
68+
this = "set-hostname-verifier" and result = "hostname-verification"
69+
or
70+
this = "header-splitting" and result = "response-splitting"
71+
or
72+
this = "xss" and result = "html-injection\" or \"js-injection"
73+
or
74+
this = ["write-file", "remote"] and result = "file-content-store"
75+
or
76+
this = ["create-file", "read-file"] and result = "path-injection"
77+
or
78+
this = ["open-url", "jdbc-url"] and result = "request-forgery"
79+
or
80+
this = "command-line-injection" and result = "command-injection"
81+
}
82+
83+
string outdatedMessage() {
84+
result =
85+
"The kind \"" + this + "\" is outdated. Use \"" + this.replacementKind() + "\" instead."
86+
}
87+
}
88+
4389
/** A valid models-as-data source kind. */
4490
class ValidSourceKind extends string {
4591
bindingset[this]

0 commit comments

Comments
 (0)