mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Python: Autoformat everything
Of course, `StringLiteral` being much longer than `StrConst` meant a bunch of files changed formatting.
This commit is contained in:
@@ -612,7 +612,8 @@ newtype TContent =
|
|||||||
key = any(Keyword kw).getArg()
|
key = any(Keyword kw).getArg()
|
||||||
or
|
or
|
||||||
// d["key"] = ...
|
// d["key"] = ...
|
||||||
key = any(SubscriptNode sub | sub.isStore() | sub.getIndex().getNode().(StringLiteral).getText())
|
key =
|
||||||
|
any(SubscriptNode sub | sub.isStore() | sub.getIndex().getNode().(StringLiteral).getText())
|
||||||
or
|
or
|
||||||
// d.setdefault("key", ...)
|
// d.setdefault("key", ...)
|
||||||
exists(CallNode call | call.getFunction().(AttrNode).getName() = "setdefault" |
|
exists(CallNode call | call.getFunction().(AttrNode).getName() = "setdefault" |
|
||||||
|
|||||||
@@ -2908,7 +2908,8 @@ module StdlibPrivate {
|
|||||||
exists(string algorithmName | result.matchesName(algorithmName) |
|
exists(string algorithmName | result.matchesName(algorithmName) |
|
||||||
this.getDigestArg().asSink() = hashlibMember(algorithmName).asSource()
|
this.getDigestArg().asSink() = hashlibMember(algorithmName).asSource()
|
||||||
or
|
or
|
||||||
this.getDigestArg().getAValueReachingSink().asExpr().(StringLiteral).getText() = algorithmName
|
this.getDigestArg().getAValueReachingSink().asExpr().(StringLiteral).getText() =
|
||||||
|
algorithmName
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -230,7 +230,8 @@ module Impl implements RegexTreeViewSig {
|
|||||||
index > 0 and
|
index > 0 and
|
||||||
exists(int previousOffset | previousOffset = this.getPartOffset(index - 1) |
|
exists(int previousOffset | previousOffset = this.getPartOffset(index - 1) |
|
||||||
result =
|
result =
|
||||||
previousOffset + re.(StringLiteral).getImplicitlyConcatenatedPart(index - 1).getContentLength()
|
previousOffset +
|
||||||
|
re.(StringLiteral).getImplicitlyConcatenatedPart(index - 1).getContentLength()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,9 @@ module ServerSideRequestForgery {
|
|||||||
exists(BinaryExprNode add |
|
exists(BinaryExprNode add |
|
||||||
add.getOp() instanceof Add and
|
add.getOp() instanceof Add and
|
||||||
add.getRight() = this.asCfgNode() and
|
add.getRight() = this.asCfgNode() and
|
||||||
not add.getLeft().getNode().(StringLiteral).getText().toLowerCase() in ["http://", "https://"]
|
not add.getLeft().getNode().(StringLiteral).getText().toLowerCase() in [
|
||||||
|
"http://", "https://"
|
||||||
|
]
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
// % formatting
|
// % formatting
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ class WebAppConstantSecretKeySource extends DataFlow::Node {
|
|||||||
API::moduleImport("os").getMember("environ").getMember("get").getACall()
|
API::moduleImport("os").getMember("environ").getMember("get").getACall()
|
||||||
] and
|
] and
|
||||||
cn.getNumArgument() = 2 and
|
cn.getNumArgument() = 2 and
|
||||||
DataFlow::localFlow(any(DataFlow::Node n | n.asExpr() instanceof StringLiteral), cn.getArg(1)) and
|
DataFlow::localFlow(any(DataFlow::Node n | n.asExpr() instanceof StringLiteral),
|
||||||
|
cn.getArg(1)) and
|
||||||
this.asExpr() = cn.asExpr()
|
this.asExpr() = cn.asExpr()
|
||||||
)
|
)
|
||||||
) and
|
) and
|
||||||
|
|||||||
@@ -25,16 +25,22 @@ class UnicodeCompatibilityNormalize extends API::CallNode {
|
|||||||
UnicodeCompatibilityNormalize() {
|
UnicodeCompatibilityNormalize() {
|
||||||
(
|
(
|
||||||
this = API::moduleImport("unicodedata").getMember("normalize").getACall() and
|
this = API::moduleImport("unicodedata").getMember("normalize").getACall() and
|
||||||
this.getParameter(0).getAValueReachingSink().asExpr().(StringLiteral).getText() in ["NFKC", "NFKD"]
|
this.getParameter(0).getAValueReachingSink().asExpr().(StringLiteral).getText() in [
|
||||||
|
"NFKC", "NFKD"
|
||||||
|
]
|
||||||
or
|
or
|
||||||
this = API::moduleImport("pyunormalize").getMember("normalize").getACall() and
|
this = API::moduleImport("pyunormalize").getMember("normalize").getACall() and
|
||||||
this.getParameter(0).getAValueReachingSink().asExpr().(StringLiteral).getText() in ["NFKC", "NFKD"]
|
this.getParameter(0).getAValueReachingSink().asExpr().(StringLiteral).getText() in [
|
||||||
|
"NFKC", "NFKD"
|
||||||
|
]
|
||||||
) and
|
) and
|
||||||
argIdx = 1
|
argIdx = 1
|
||||||
or
|
or
|
||||||
(
|
(
|
||||||
this = API::moduleImport("textnorm").getMember("normalize_unicode").getACall() and
|
this = API::moduleImport("textnorm").getMember("normalize_unicode").getACall() and
|
||||||
this.getParameter(1).getAValueReachingSink().asExpr().(StringLiteral).getText() in ["NFKC", "NFKD"]
|
this.getParameter(1).getAValueReachingSink().asExpr().(StringLiteral).getText() in [
|
||||||
|
"NFKC", "NFKD"
|
||||||
|
]
|
||||||
or
|
or
|
||||||
this = API::moduleImport("unidecode").getMember("unidecode").getACall()
|
this = API::moduleImport("unidecode").getMember("unidecode").getACall()
|
||||||
or
|
or
|
||||||
|
|||||||
@@ -122,8 +122,12 @@ private module Sendgrid {
|
|||||||
contentElement =
|
contentElement =
|
||||||
this.getKeywordParameter("request_body").getSubscript("content").getASubscript()
|
this.getKeywordParameter("request_body").getSubscript("content").getASubscript()
|
||||||
|
|
|
|
||||||
contentElement.getSubscript("type").getAValueReachingSink().asExpr().(StringLiteral).getText() =
|
contentElement
|
||||||
["text/html", "text/x-amp-html"] and
|
.getSubscript("type")
|
||||||
|
.getAValueReachingSink()
|
||||||
|
.asExpr()
|
||||||
|
.(StringLiteral)
|
||||||
|
.getText() = ["text/html", "text/x-amp-html"] and
|
||||||
result = contentElement.getSubscript("value").getAValueReachingSink()
|
result = contentElement.getSubscript("value").getAValueReachingSink()
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ module SmtpLib {
|
|||||||
|
|
||||||
private DataFlow::CallCfgNode mimeText(string mimetype) {
|
private DataFlow::CallCfgNode mimeText(string mimetype) {
|
||||||
result = smtpMimeTextInstance().getACall() and
|
result = smtpMimeTextInstance().getACall() and
|
||||||
[result.getArg(1), result.getArgByName("_subtype")].asExpr().(StringLiteral).getText() = mimetype
|
[result.getArg(1), result.getArgByName("_subtype")].asExpr().(StringLiteral).getText() =
|
||||||
|
mimetype
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -260,7 +260,12 @@ module Gzip {
|
|||||||
this = gzipCall.getParameter(0, "filename").asSink() and
|
this = gzipCall.getParameter(0, "filename").asSink() and
|
||||||
(
|
(
|
||||||
not exists(
|
not exists(
|
||||||
gzipCall.getParameter(1, "mode").getAValueReachingSink().asExpr().(StringLiteral).getText()
|
gzipCall
|
||||||
|
.getParameter(1, "mode")
|
||||||
|
.getAValueReachingSink()
|
||||||
|
.asExpr()
|
||||||
|
.(StringLiteral)
|
||||||
|
.getText()
|
||||||
) or
|
) or
|
||||||
gzipCall
|
gzipCall
|
||||||
.getParameter(1, "mode")
|
.getParameter(1, "mode")
|
||||||
@@ -297,7 +302,12 @@ module Bz2 {
|
|||||||
this = bz2Call.getParameter(0, "filename").asSink() and
|
this = bz2Call.getParameter(0, "filename").asSink() and
|
||||||
(
|
(
|
||||||
not exists(
|
not exists(
|
||||||
bz2Call.getParameter(1, "mode").getAValueReachingSink().asExpr().(StringLiteral).getText()
|
bz2Call
|
||||||
|
.getParameter(1, "mode")
|
||||||
|
.getAValueReachingSink()
|
||||||
|
.asExpr()
|
||||||
|
.(StringLiteral)
|
||||||
|
.getText()
|
||||||
) or
|
) or
|
||||||
bz2Call
|
bz2Call
|
||||||
.getParameter(1, "mode")
|
.getParameter(1, "mode")
|
||||||
@@ -334,7 +344,12 @@ module Lzma {
|
|||||||
this = lzmaCall.getParameter(0, "filename").asSink() and
|
this = lzmaCall.getParameter(0, "filename").asSink() and
|
||||||
(
|
(
|
||||||
not exists(
|
not exists(
|
||||||
lzmaCall.getParameter(1, "mode").getAValueReachingSink().asExpr().(StringLiteral).getText()
|
lzmaCall
|
||||||
|
.getParameter(1, "mode")
|
||||||
|
.getAValueReachingSink()
|
||||||
|
.asExpr()
|
||||||
|
.(StringLiteral)
|
||||||
|
.getText()
|
||||||
) or
|
) or
|
||||||
lzmaCall
|
lzmaCall
|
||||||
.getParameter(1, "mode")
|
.getParameter(1, "mode")
|
||||||
|
|||||||
@@ -204,8 +204,11 @@ abstract class ClientSuppliedSecret extends DataFlow::CallCfgNode { }
|
|||||||
private class FlaskClientSuppliedSecret extends ClientSuppliedSecret {
|
private class FlaskClientSuppliedSecret extends ClientSuppliedSecret {
|
||||||
FlaskClientSuppliedSecret() {
|
FlaskClientSuppliedSecret() {
|
||||||
this = Flask::request().getMember("headers").getMember(["get", "get_all", "getlist"]).getACall() and
|
this = Flask::request().getMember("headers").getMember(["get", "get_all", "getlist"]).getACall() and
|
||||||
[this.getArg(0), this.getArgByName(["key", "name"])].asExpr().(StringLiteral).getText().toLowerCase() =
|
[this.getArg(0), this.getArgByName(["key", "name"])]
|
||||||
sensitiveheaders()
|
.asExpr()
|
||||||
|
.(StringLiteral)
|
||||||
|
.getText()
|
||||||
|
.toLowerCase() = sensitiveheaders()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,8 +246,11 @@ private class WerkzeugClientSuppliedSecret extends ClientSuppliedSecret {
|
|||||||
WerkzeugClientSuppliedSecret() {
|
WerkzeugClientSuppliedSecret() {
|
||||||
this =
|
this =
|
||||||
headers().getMember(["headers", "META"]).getMember(["get", "get_all", "getlist"]).getACall() and
|
headers().getMember(["headers", "META"]).getMember(["get", "get_all", "getlist"]).getACall() and
|
||||||
[this.getArg(0), this.getArgByName(["key", "name"])].asExpr().(StringLiteral).getText().toLowerCase() =
|
[this.getArg(0), this.getArgByName(["key", "name"])]
|
||||||
sensitiveheaders()
|
.asExpr()
|
||||||
|
.(StringLiteral)
|
||||||
|
.getText()
|
||||||
|
.toLowerCase() = sensitiveheaders()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user