mirror of
https://github.com/github/codeql.git
synced 2025-12-20 18:56:32 +01:00
Autoformat.
This commit is contained in:
@@ -50,8 +50,7 @@ from EqOrSwitch et, TypeofExpr typeof, ConstantString str
|
||||
where
|
||||
typeof = et.getAnOperand().getUnderlyingValue() and
|
||||
str = et.getAnOperand().getUnderlyingValue() and
|
||||
not str
|
||||
.getStringValue()
|
||||
not str.getStringValue()
|
||||
.regexpMatch("undefined|boolean|number|string|object|function|symbol|unknown|date|bigint")
|
||||
select typeof,
|
||||
"The result of this 'typeof' expression is compared to '$@', but the two can never be equal.",
|
||||
|
||||
@@ -59,8 +59,7 @@ predicate matchesBeginningOfString(RegExpTerm term) {
|
||||
* `i` is bound to the index of the last child in the top-level domain part.
|
||||
*/
|
||||
predicate hasTopLevelDomainEnding(RegExpSequence seq, int i) {
|
||||
seq
|
||||
.getChild(i)
|
||||
seq.getChild(i)
|
||||
.(RegExpConstant)
|
||||
.getValue()
|
||||
.regexpMatch("(?i)" + RegExpPatterns::commonTLD() + "(:\\d+)?([/?#].*)?") and
|
||||
|
||||
@@ -34,8 +34,7 @@ predicate isDangerous(RegExpTerm t) {
|
||||
exists(RegExpSequence seq | seq = t |
|
||||
t.getChild(0).getConstantValue() = "<" and
|
||||
// the `cript|scrip` case has been observed in the wild, not sure what the goal of that pattern is...
|
||||
t
|
||||
.getChild(0)
|
||||
t.getChild(0)
|
||||
.getSuccessor+()
|
||||
.getAMatchedString()
|
||||
.regexpMatch("(?i)iframe|script|cript|scrip|style")
|
||||
|
||||
@@ -80,8 +80,7 @@ private DataFlow::Node goodRandom(DataFlow::TypeTracker t, DataFlow::SourceNode
|
||||
// reading a number from a Buffer.
|
||||
exists(DataFlow::MethodCallNode call | result = call |
|
||||
call.getReceiver() = goodRandom(t2, source) and
|
||||
call
|
||||
.getMethodName()
|
||||
call.getMethodName()
|
||||
.regexpMatch("read(BigInt|BigUInt|Double|Float|Int|UInt)(8|16|32|64)?(BE|LE)?")
|
||||
)
|
||||
)
|
||||
|
||||
@@ -65,8 +65,7 @@ module LdapInjection {
|
||||
sanitize = "(?:escape|saniti[sz]e|validate|filter)" and
|
||||
input = "[Ii]nput?"
|
||||
|
|
||||
this
|
||||
.getCalleeName()
|
||||
this.getCalleeName()
|
||||
.regexpMatch("(?i)(" + sanitize + input + ")" + "|(" + input + sanitize + ")")
|
||||
)
|
||||
}
|
||||
|
||||
@@ -38,8 +38,7 @@ private predicate codeGeneratorMarkerComment(Comment c, string tool) {
|
||||
toolPattern =
|
||||
"js_of_ocaml|CoffeeScript|LiveScript|dart2js|ANTLR|PEG\\.js|Opal|JSX|jison(?:-lex)?|(?:Microsoft \\(R\\) AutoRest Code Generator)|purs" and
|
||||
tool =
|
||||
c
|
||||
.getText()
|
||||
c.getText()
|
||||
.regexpCapture("(?s)[\\s*]*(?:parser |Code )?[gG]eneratedy? (?:from .*)?by (" +
|
||||
toolPattern + ")\\b.*", 1)
|
||||
)
|
||||
@@ -55,9 +54,8 @@ private class GenericGeneratedCodeMarkerComment extends GeneratedCodeMarkerComme
|
||||
entity = "code|file|class|interface|art[ei]fact|module|script" and
|
||||
was = "was|is|has been" and
|
||||
automatically = "automatically |mechanically |auto[- ]?" and
|
||||
line
|
||||
.regexpMatch("(?i).*\\b(This|The following) (" + entity + ") (" + was + ") (" +
|
||||
automatically + ")?gener(e?)ated\\b.*")
|
||||
line.regexpMatch("(?i).*\\b(This|The following) (" + entity + ") (" + was + ") (" +
|
||||
automatically + ")?gener(e?)ated\\b.*")
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -68,8 +68,7 @@ abstract class Module extends TopLevel {
|
||||
or
|
||||
// a re-export using spread-operator. E.g. `const foo = require("./foo"); module.exports = {bar: bar, ...foo};`
|
||||
exists(ObjectExpr obj | obj = this.(NodeModule).getAModuleExportsNode().asExpr() |
|
||||
obj
|
||||
.getAProperty()
|
||||
obj.getAProperty()
|
||||
.(SpreadProperty)
|
||||
.getInit()
|
||||
.(SpreadElement)
|
||||
|
||||
@@ -83,8 +83,7 @@ class NodeModule extends Module {
|
||||
// a re-export using spread-operator. E.g. `const foo = require("./foo"); module.exports = {bar: bar, ...foo};`
|
||||
exists(ObjectExpr obj | obj = getAModuleExportsNode().asExpr() |
|
||||
result =
|
||||
obj
|
||||
.getAProperty()
|
||||
obj.getAProperty()
|
||||
.(SpreadProperty)
|
||||
.getInit()
|
||||
.(SpreadElement)
|
||||
|
||||
@@ -602,8 +602,7 @@ class SsaVariableCapture extends SsaImplicitDefinition, TCapture {
|
||||
string filepath, int startline, int startcolumn, int endline, int endcolumn
|
||||
) {
|
||||
exists(ReachableBasicBlock bb, int i | definesAt(bb, i, _) |
|
||||
bb
|
||||
.getNode(i)
|
||||
bb.getNode(i)
|
||||
.getLocation()
|
||||
.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
|
||||
)
|
||||
|
||||
@@ -336,8 +336,7 @@ module DataFlow {
|
||||
override predicate hasLocationInfo(
|
||||
string filepath, int startline, int startcolumn, int endline, int endcolumn
|
||||
) {
|
||||
prop
|
||||
.(Locatable)
|
||||
prop.(Locatable)
|
||||
.getLocation()
|
||||
.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
|
||||
}
|
||||
|
||||
@@ -846,8 +846,7 @@ private class ApplicationInsightsInstance extends FrameworkLibraryInstance {
|
||||
|
||||
ApplicationInsightsInstance() {
|
||||
version =
|
||||
this
|
||||
.(TopLevel)
|
||||
this.(TopLevel)
|
||||
.getFile()
|
||||
.getAbsolutePath()
|
||||
.regexpCapture(any(ApplicationInsights t).getAURLRegex(), 1)
|
||||
@@ -891,8 +890,7 @@ private class TwitterTextClassic extends FrameworkLibraryWithURLRegex {
|
||||
*/
|
||||
private class TwitterTextClassicInstance extends FrameworkLibraryInstance {
|
||||
TwitterTextClassicInstance() {
|
||||
this
|
||||
.(TopLevel)
|
||||
this.(TopLevel)
|
||||
.getFile()
|
||||
.getAbsolutePath()
|
||||
.regexpMatch(any(TwitterTextClassic t).getAURLRegex())
|
||||
|
||||
@@ -153,8 +153,7 @@ private class TemplateFieldNgSourceProvider extends NgSourceProvider {
|
||||
TemplateFieldNgSourceProvider() {
|
||||
this = directive.getMember("template").asExpr() and
|
||||
source =
|
||||
this
|
||||
.(ConstantString)
|
||||
this.(ConstantString)
|
||||
.getStringValue()
|
||||
.regexpFind(getInterpolatedExpressionPattern(), _, offset)
|
||||
}
|
||||
|
||||
@@ -217,8 +217,7 @@ predicate isMultiLicenseBundle(TopLevel tl) {
|
||||
// case: ordinary block comments lines that start with a license
|
||||
count(BlockComment head |
|
||||
head.getTopLevel() = tl and
|
||||
head
|
||||
.getLine(_)
|
||||
head.getLine(_)
|
||||
.regexpMatch("(?i)[\\s*]*(@license\\b.*|The [a-z0-9-]+ License (\\([a-z0-9-]+\\))?\\s*)")
|
||||
) > 1
|
||||
}
|
||||
|
||||
@@ -792,8 +792,7 @@ module ClientRequest {
|
||||
this = cmd and
|
||||
(
|
||||
cmd.getACommandArgument().getStringValue() = "curl" or
|
||||
cmd
|
||||
.getACommandArgument()
|
||||
cmd.getACommandArgument()
|
||||
.(StringOps::ConcatenationRoot)
|
||||
.getConstantStringParts()
|
||||
.regexpMatch("curl .*")
|
||||
|
||||
@@ -114,8 +114,7 @@ module Fastify {
|
||||
if methodName = "route"
|
||||
then
|
||||
result =
|
||||
this
|
||||
.flow()
|
||||
this.flow()
|
||||
.(DataFlow::MethodCallNode)
|
||||
.getOptionArgument(0,
|
||||
[
|
||||
|
||||
@@ -298,9 +298,8 @@ module Koa {
|
||||
|
||||
ResponseSendArgument() {
|
||||
exists(DataFlow::PropWrite pwn |
|
||||
pwn
|
||||
.writes(DataFlow::valueNode(rh.getAResponseOrContextExpr()), "body",
|
||||
DataFlow::valueNode(this))
|
||||
pwn.writes(DataFlow::valueNode(rh.getAResponseOrContextExpr()), "body",
|
||||
DataFlow::valueNode(this))
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -72,8 +72,7 @@ private predicate neverReturnsJQuery(string name) {
|
||||
decl.getBaseName() = "jQuery" and
|
||||
decl.getName() = name
|
||||
|
|
||||
not decl
|
||||
.getDocumentation()
|
||||
not decl.getDocumentation()
|
||||
.getATagByTitle("return")
|
||||
.getType()
|
||||
.getAnUnderlyingType()
|
||||
@@ -364,11 +363,10 @@ private module JQueryClientRequest {
|
||||
*/
|
||||
private DataFlow::SourceNode getAResponseNodeFromAnXHRObject(DataFlow::SourceNode obj) {
|
||||
result =
|
||||
obj
|
||||
.getAPropertyRead(any(string s |
|
||||
s = "responseText" or
|
||||
s = "responseXML"
|
||||
))
|
||||
obj.getAPropertyRead(any(string s |
|
||||
s = "responseText" or
|
||||
s = "responseXML"
|
||||
))
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -63,8 +63,7 @@ module CleartextLogging {
|
||||
)
|
||||
or
|
||||
// avoid i18n strings
|
||||
this
|
||||
.(DataFlow::PropRead)
|
||||
this.(DataFlow::PropRead)
|
||||
.getBase()
|
||||
.asExpr()
|
||||
.(VarRef)
|
||||
|
||||
@@ -63,8 +63,7 @@ module Shared {
|
||||
class QuoteGuard extends SanitizerGuard, StringOps::Includes {
|
||||
QuoteGuard() {
|
||||
this.getSubstring().mayHaveStringValue("\"") and
|
||||
this
|
||||
.getBaseString()
|
||||
this.getBaseString()
|
||||
.getALocalSource()
|
||||
.flowsTo(any(IncompleteHTML::HtmlAttributeConcatenation attributeConcat))
|
||||
}
|
||||
|
||||
@@ -69,8 +69,7 @@ module XssThroughDom {
|
||||
) and
|
||||
// looks like a $("<p>" + ... ) source, which is benign for this query.
|
||||
not exists(DataFlow::Node prefix |
|
||||
DomBasedXss::isPrefixOfJQueryHtmlString(this
|
||||
.getReceiver()
|
||||
DomBasedXss::isPrefixOfJQueryHtmlString(this.getReceiver()
|
||||
.(DataFlow::CallNode)
|
||||
.getAnArgument(), prefix)
|
||||
|
|
||||
|
||||
Reference in New Issue
Block a user