mirror of
https://github.com/github/codeql.git
synced 2026-05-02 20:25:13 +02:00
JS: Remove globalFlowPred()
This commit is contained in:
@@ -259,4 +259,18 @@ module Closure {
|
||||
DataFlow::SourceNode moduleImport(string moduleName) {
|
||||
getClosureNamespaceFromSourceNode(result) = moduleName
|
||||
}
|
||||
|
||||
private class ClosureNamespaceCall extends DataFlow::InvokeNode {
|
||||
override Function getACallee(int imprecision) {
|
||||
result = super.getACallee(imprecision)
|
||||
or
|
||||
imprecision = 0 and
|
||||
exists(string name |
|
||||
GlobalAccessPath::isAssignedInUniqueFile(name) and
|
||||
GlobalAccessPath::fromRhs(result.flow()) = name and
|
||||
GlobalAccessPath::fromReference(getCalleeNode()) = name and
|
||||
not result.getTopLevel().isExterns()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,14 +47,6 @@ class AnalyzedNode extends DataFlow::Node {
|
||||
*/
|
||||
AnalyzedNode localFlowPred() { result = getAPredecessor() }
|
||||
|
||||
/**
|
||||
* INTERNAL. Do not use.
|
||||
*
|
||||
* Gets another data flow node whose value flows into this node in a global step
|
||||
* (this is, involving global variables).
|
||||
*/
|
||||
AnalyzedNode globalFlowPred() { none() }
|
||||
|
||||
/**
|
||||
* Gets an abstract value that this node may evaluate to at runtime.
|
||||
*
|
||||
@@ -92,9 +84,6 @@ class AnalyzedNode extends DataFlow::Node {
|
||||
exists(DataFlow::Incompleteness cause |
|
||||
isIncomplete(cause) and result = TIndefiniteAbstractValue(cause)
|
||||
)
|
||||
or
|
||||
result = globalFlowPred().getALocalValue() and
|
||||
shouldTrackGlobally(result)
|
||||
}
|
||||
|
||||
/** Gets a type inferred for this node. */
|
||||
@@ -295,8 +284,3 @@ private class AnalyzedAsyncFunction extends AnalyzedFunction {
|
||||
|
||||
override AbstractValue getAReturnValue() { result = TAbstractOtherObject() }
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if the given value should be propagated along `globalFlowPred()` edges.
|
||||
*/
|
||||
private predicate shouldTrackGlobally(AbstractValue value) { value instanceof AbstractCallable }
|
||||
|
||||
@@ -119,6 +119,7 @@ private module CachedSteps {
|
||||
predicate calls(DataFlow::InvokeNode invk, Function f) {
|
||||
f = invk.getACallee(0)
|
||||
or
|
||||
not f.getTopLevel().isExterns() and
|
||||
exists(DataFlow::ClassNode cls, string name |
|
||||
callResolvesToMember(invk, cls, name) and
|
||||
f = cls.getInstanceMethod(name).getFunction()
|
||||
|
||||
@@ -394,13 +394,6 @@ private class AnalyzedClosureGlobalAccessPath extends AnalyzedNode, AnalyzedProp
|
||||
accessPath = Closure::getClosureNamespaceFromSourceNode(this)
|
||||
}
|
||||
|
||||
override AnalyzedNode globalFlowPred() {
|
||||
exists(DataFlow::PropWrite write |
|
||||
Closure::getWrittenClosureNamespace(write) = accessPath and
|
||||
result = write.getRhs()
|
||||
)
|
||||
}
|
||||
|
||||
override predicate reads(AbstractValue base, string propName) {
|
||||
exists(Closure::ClosureModule mod |
|
||||
mod.getClosureNamespace() = accessPath and
|
||||
|
||||
Reference in New Issue
Block a user