mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
We are no longer bound to the platform-specific directories, so simplify the test organization. If you don't want this change, just skip merging this PR. It's purely optional. I kept the platform-specific directories around under `kotlin`, but you could also easily merge all these together if you find them unhelpful. I'll leave that change to you.
37 lines
1005 B
Plaintext
37 lines
1005 B
Plaintext
import java
|
|
import semmle.code.java.dataflow.DataFlow
|
|
|
|
query predicate callables(Callable c, RefType declType, string kind) {
|
|
c.fromSource() and
|
|
declType = c.getDeclaringType() and
|
|
(
|
|
kind = c.compilerGeneratedReason()
|
|
or
|
|
not exists(c.compilerGeneratedReason()) and kind = "from source"
|
|
)
|
|
}
|
|
|
|
query predicate superAccesses(
|
|
SuperAccess sa, RefType enclosingType, Callable enclosingCallable, Expr qualifier
|
|
) {
|
|
sa.getQualifier() = qualifier and
|
|
enclosingCallable = sa.getEnclosingCallable() and
|
|
enclosingType = enclosingCallable.getDeclaringType()
|
|
}
|
|
|
|
module Config implements DataFlow::ConfigSig {
|
|
predicate isSource(DataFlow::Node x) {
|
|
x.asExpr() instanceof IntegerLiteral and x.getEnclosingCallable().fromSource()
|
|
}
|
|
|
|
predicate isSink(DataFlow::Node x) {
|
|
x.asExpr().(Argument).getCall().getCallee().getName() = "sink"
|
|
}
|
|
}
|
|
|
|
module Flow = DataFlow::Global<Config>;
|
|
|
|
from DataFlow::Node source, DataFlow::Node sink
|
|
where Flow::flow(source, sink)
|
|
select source, sink
|