mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
Autoformat
This commit is contained in:
@@ -30,9 +30,7 @@ query predicate nestedTypes(NestedType nt, RefType parent) {
|
||||
parent = nt.getEnclosingType()
|
||||
}
|
||||
|
||||
query predicate javaKotlinCalleeAgreement(
|
||||
MethodCall javaMa, MethodCall kotlinMa, Callable callee
|
||||
) {
|
||||
query predicate javaKotlinCalleeAgreement(MethodCall javaMa, MethodCall kotlinMa, Callable callee) {
|
||||
javaMa.getCallee() = callee and
|
||||
kotlinMa.getCallee() = callee and
|
||||
javaMa.getFile().getExtension() = "java" and
|
||||
|
||||
@@ -1251,7 +1251,7 @@ class ClassInstanceExpr extends Expr, ConstructorCall, @classinstancexpr {
|
||||
override string getAPrimaryQlClass() { result = "ClassInstanceExpr" }
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* An explicit `new ClassName(...)` expression.
|
||||
*
|
||||
* Note this does not include implicit instance creation such as lambda expressions
|
||||
|
||||
@@ -58,9 +58,7 @@ private predicate implicitEnclosingThisCopy(ConstructorCall cc, RefType t1, RefT
|
||||
private predicate enclosingInstanceAccess(ExprParent e, RefType t) {
|
||||
e.(InstanceAccess).isEnclosingInstanceAccess(t)
|
||||
or
|
||||
exists(MethodCall ma |
|
||||
ma.isEnclosingMethodCall(t) and ma = e and not exists(ma.getQualifier())
|
||||
)
|
||||
exists(MethodCall ma | ma.isEnclosingMethodCall(t) and ma = e and not exists(ma.getQualifier()))
|
||||
or
|
||||
exists(FieldAccess fa | fa.isEnclosingFieldAccess(t) and fa = e and not exists(fa.getQualifier()))
|
||||
or
|
||||
|
||||
@@ -466,9 +466,7 @@ class ObjectOutputStreamVar extends LocalVariableDecl {
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for `getAWriteObjectMethodCall`. */
|
||||
deprecated MethodCall getAWriteObjectMethodAccess() {
|
||||
result = this.getAWriteObjectMethodCall()
|
||||
}
|
||||
deprecated MethodCall getAWriteObjectMethodAccess() { result = this.getAWriteObjectMethodCall() }
|
||||
}
|
||||
|
||||
/** Flow through string formatting. */
|
||||
|
||||
@@ -78,9 +78,7 @@ class MockitoInitedTest extends Class {
|
||||
m.calls*(initMocks)
|
||||
)
|
||||
or
|
||||
exists(MethodCall call | call.getCallee() = initMocks |
|
||||
call.getArgument(0).getType() = this
|
||||
)
|
||||
exists(MethodCall call | call.getCallee() = initMocks | call.getArgument(0).getType() = this)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,9 +158,8 @@ private class IsUnixFromPosixFromFileSystem extends IsUnixGuard instanceof Metho
|
||||
supportedFileAttributeViewsMethod.hasName("supportedFileAttributeViews") and
|
||||
supportedFileAttributeViewsMethod.getDeclaringType() instanceof TypeFileSystem
|
||||
|
|
||||
DataFlow::localExprFlow(any(MethodCall ma |
|
||||
ma.getMethod() = supportedFileAttributeViewsMethod
|
||||
), super.getQualifier())
|
||||
DataFlow::localExprFlow(any(MethodCall ma | ma.getMethod() = supportedFileAttributeViewsMethod),
|
||||
super.getQualifier())
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,7 @@ private predicate directFileRead(Expr fileAccess, Expr fileReadingExpr) {
|
||||
.hasQualifiedName("java.io", ["RandomAccessFile", "FileReader", "FileInputStream"])
|
||||
)
|
||||
or
|
||||
exists(MethodCall ma, Method filesMethod |
|
||||
ma = fileReadingExpr and filesMethod = ma.getMethod()
|
||||
|
|
||||
exists(MethodCall ma, Method filesMethod | ma = fileReadingExpr and filesMethod = ma.getMethod() |
|
||||
(
|
||||
// Identify all method calls on the `Files` class that imply that we are reading the file
|
||||
// represented by the first argument.
|
||||
|
||||
@@ -18,9 +18,7 @@ deprecated class EqualsAccess = EqualsCall;
|
||||
/**
|
||||
* Holds if `sink` compares password `p` against a hardcoded expression `source`.
|
||||
*/
|
||||
predicate isHardcodedCredentialsComparison(
|
||||
EqualsCall sink, HardcodedExpr source, PasswordVariable p
|
||||
) {
|
||||
predicate isHardcodedCredentialsComparison(EqualsCall sink, HardcodedExpr source, PasswordVariable p) {
|
||||
source = sink.getQualifier() and
|
||||
p.getAnAccess() = sink.getArgument(0)
|
||||
or
|
||||
|
||||
@@ -60,4 +60,4 @@ class PartialPathTraversalMethodCall extends MethodCall {
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for `PartialPathTraversalMethodCall`. */
|
||||
deprecated class PartialPathTraversalMethodAccess = PartialPathTraversalMethodCall;
|
||||
deprecated class PartialPathTraversalMethodAccess = PartialPathTraversalMethodCall;
|
||||
|
||||
@@ -260,4 +260,5 @@ class MethodCallInsecureGuavaFilesCreateTempFile extends MethodCallInsecureFileC
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for `MethodCallInsecureGuavaFilesCreateTempFile`. */
|
||||
deprecated class MethodAccessInsecureGuavaFilesCreateTempFile = MethodCallInsecureGuavaFilesCreateTempFile;
|
||||
deprecated class MethodAccessInsecureGuavaFilesCreateTempFile =
|
||||
MethodCallInsecureGuavaFilesCreateTempFile;
|
||||
|
||||
@@ -15,9 +15,7 @@ import java
|
||||
|
||||
class SpecialCollectionCreation extends MethodCall {
|
||||
SpecialCollectionCreation() {
|
||||
exists(Method m, RefType rt |
|
||||
m = this.(MethodCall).getCallee() and rt = m.getDeclaringType()
|
||||
|
|
||||
exists(Method m, RefType rt | m = this.(MethodCall).getCallee() and rt = m.getDeclaringType() |
|
||||
rt.hasQualifiedName("java.util", "Arrays") and m.hasName("asList")
|
||||
or
|
||||
rt.hasQualifiedName("java.util", "Collections") and
|
||||
|
||||
@@ -32,9 +32,7 @@ where
|
||||
v instanceof LocalVariableDecl and exists(ReturnStmt ret | ret.getResult() = va)
|
||||
or
|
||||
// ...or a call to a query method on `v`.
|
||||
exists(MethodCall ma | va = ma.getQualifier() |
|
||||
ma.getMethod() instanceof ContainerQueryMethod
|
||||
)
|
||||
exists(MethodCall ma | va = ma.getQualifier() | ma.getMethod() instanceof ContainerQueryMethod)
|
||||
) and
|
||||
// There is at least one call to a query method.
|
||||
exists(MethodCall ma | v.getAnAccess() = ma.getQualifier() |
|
||||
|
||||
@@ -30,9 +30,7 @@ predicate locallySynchronized(MethodCall ma) {
|
||||
predicate hasUnsynchronizedCall(Method m) {
|
||||
m.isPublic() and not m.isSynchronized()
|
||||
or
|
||||
exists(MethodCall ma, Method caller |
|
||||
ma.getMethod() = m and caller = ma.getEnclosingCallable()
|
||||
|
|
||||
exists(MethodCall ma, Method caller | ma.getMethod() = m and caller = ma.getEnclosingCallable() |
|
||||
hasUnsynchronizedCall(caller) and
|
||||
not caller.isSynchronized() and
|
||||
not locallySynchronized(ma)
|
||||
|
||||
@@ -25,9 +25,7 @@ import semmle.code.java.security.TempDirLocalInformationDisclosureQuery
|
||||
* resulting in a zero-length paths.
|
||||
*/
|
||||
module InsecureMethodPathGraph implements DataFlow::PathGraphSig<MethodCallInsecureFileCreation> {
|
||||
predicate edges(MethodCallInsecureFileCreation n1, MethodCallInsecureFileCreation n2) {
|
||||
none()
|
||||
}
|
||||
predicate edges(MethodCallInsecureFileCreation n1, MethodCallInsecureFileCreation n2) { none() }
|
||||
|
||||
predicate nodes(MethodCallInsecureFileCreation n, string key, string val) {
|
||||
key = "semmle.label" and val = n.toString()
|
||||
|
||||
@@ -18,8 +18,7 @@ import semmle.code.java.security.ConditionalBypassQuery
|
||||
import ConditionalBypassFlow::PathGraph
|
||||
|
||||
from
|
||||
ConditionalBypassFlow::PathNode source, ConditionalBypassFlow::PathNode sink, MethodCall m,
|
||||
Expr e
|
||||
ConditionalBypassFlow::PathNode source, ConditionalBypassFlow::PathNode sink, MethodCall m, Expr e
|
||||
where
|
||||
conditionControlsMethod(m, e) and
|
||||
sink.getNode().asExpr() = e and
|
||||
|
||||
@@ -155,9 +155,7 @@ predicate inDifferentRunnables(MethodCall ma1, MethodCall ma2) {
|
||||
* in statement `inner` that is qualified by one of the parameters of `outer`, and there is
|
||||
* another access to `outer` that may cause locking to be performed in a different order.
|
||||
*/
|
||||
predicate badMethodCallLockOrder(
|
||||
MethodCall outerAccess, MethodCall innerAccess, MethodCall other
|
||||
) {
|
||||
predicate badMethodCallLockOrder(MethodCall outerAccess, MethodCall innerAccess, MethodCall other) {
|
||||
exists(Synched outer, Synched inner |
|
||||
inner = innerAccess and
|
||||
inner = outer.getInnerSynch() and
|
||||
|
||||
@@ -91,9 +91,7 @@ predicate exprHasNoEffect(Expr e) {
|
||||
constructorHasEffect(c)
|
||||
)
|
||||
or
|
||||
exists(MethodCall ma, Method m |
|
||||
bad = ma and m = ma.getMethod().getAPossibleImplementation()
|
||||
|
|
||||
exists(MethodCall ma, Method m | bad = ma and m = ma.getMethod().getAPossibleImplementation() |
|
||||
methodHasEffect(m) or not m.fromSource()
|
||||
)
|
||||
)
|
||||
|
||||
@@ -56,9 +56,7 @@ private module BindingUnsafeRemoteObjectConfig implements DataFlow::ConfigSig {
|
||||
}
|
||||
|
||||
predicate isSink(DataFlow::Node sink) {
|
||||
exists(MethodCall ma | ma.getArgument(1) = sink.asExpr() |
|
||||
ma.getMethod() instanceof BindMethod
|
||||
)
|
||||
exists(MethodCall ma | ma.getArgument(1) = sink.asExpr() | ma.getMethod() instanceof BindMethod)
|
||||
}
|
||||
|
||||
predicate isAdditionalFlowStep(DataFlow::Node fromNode, DataFlow::Node toNode) {
|
||||
|
||||
@@ -117,9 +117,7 @@ predicate hasHashAncestor(MethodCall ma) {
|
||||
}
|
||||
|
||||
/** Holds if `MethodCall` ma is a hashing call without a sibling node making another hashing call. */
|
||||
predicate isSingleHashMethodCall(MethodCall ma) {
|
||||
isHashAccess(ma) and not hasAnotherHashCall(ma)
|
||||
}
|
||||
predicate isSingleHashMethodCall(MethodCall ma) { isHashAccess(ma) and not hasAnotherHashCall(ma) }
|
||||
|
||||
/** Holds if `MethodCall` ma is a single hashing call that is not invoked by a wrapper method. */
|
||||
predicate isSink(MethodCall ma) { isSingleHashMethodCall(ma) and not hasHashAncestor(ma) }
|
||||
|
||||
@@ -2,9 +2,7 @@ import java
|
||||
import semmle.code.java.dataflow.DataFlow
|
||||
|
||||
module Config implements DataFlow::ConfigSig {
|
||||
predicate isSource(DataFlow::Node n) {
|
||||
n.asExpr().(MethodCall).getCallee().getName() = "source"
|
||||
}
|
||||
predicate isSource(DataFlow::Node n) { n.asExpr().(MethodCall).getCallee().getName() = "source" }
|
||||
|
||||
predicate isSink(DataFlow::Node n) {
|
||||
n.asExpr().(Argument).getCall().getCallee().getName() = "sink"
|
||||
|
||||
@@ -2,9 +2,7 @@ import java
|
||||
import semmle.code.java.dataflow.DataFlow
|
||||
|
||||
module Config implements DataFlow::ConfigSig {
|
||||
predicate isSource(DataFlow::Node n) {
|
||||
n.asExpr().(MethodCall).getMethod().getName() = "source"
|
||||
}
|
||||
predicate isSource(DataFlow::Node n) { n.asExpr().(MethodCall).getMethod().getName() = "source" }
|
||||
|
||||
predicate isSink(DataFlow::Node n) {
|
||||
n.asExpr().(Argument).getCall().getCallee().getName() = "sink"
|
||||
|
||||
@@ -2,9 +2,7 @@ import java
|
||||
import semmle.code.java.dataflow.DataFlow
|
||||
|
||||
module Config implements DataFlow::ConfigSig {
|
||||
predicate isSource(DataFlow::Node src) {
|
||||
src.asExpr().(MethodCall).getMethod().hasName("source")
|
||||
}
|
||||
predicate isSource(DataFlow::Node src) { src.asExpr().(MethodCall).getMethod().hasName("source") }
|
||||
|
||||
predicate isSink(DataFlow::Node sink) {
|
||||
exists(MethodCall ma |
|
||||
|
||||
@@ -5,9 +5,7 @@ module Config implements DataFlow::ConfigSig {
|
||||
predicate isSource(DataFlow::Node n) { n.asExpr().(MethodCall).getMethod().hasName("taint") }
|
||||
|
||||
predicate isSink(DataFlow::Node n) {
|
||||
exists(MethodCall sink |
|
||||
sink.getAnArgument() = n.asExpr() and sink.getMethod().hasName("sink")
|
||||
)
|
||||
exists(MethodCall sink | sink.getAnArgument() = n.asExpr() and sink.getMethod().hasName("sink"))
|
||||
}
|
||||
|
||||
predicate isAdditionalFlowStep(DataFlow::Node n1, DataFlow::Node n2) {
|
||||
|
||||
@@ -6,9 +6,7 @@ module Config implements DataFlow::ConfigSig {
|
||||
predicate isSource(Node n) { n.asExpr().(MethodCall).getMethod().hasName("source") }
|
||||
|
||||
predicate isSink(Node n) {
|
||||
exists(MethodCall sink |
|
||||
sink.getAnArgument() = n.asExpr() and sink.getMethod().hasName("sink")
|
||||
)
|
||||
exists(MethodCall sink | sink.getAnArgument() = n.asExpr() and sink.getMethod().hasName("sink"))
|
||||
}
|
||||
|
||||
predicate isAdditionalFlowStep(Node n1, Node n2) {
|
||||
|
||||
Reference in New Issue
Block a user