mirror of
https://github.com/github/codeql.git
synced 2026-05-01 19:55:15 +02:00
JS: Support AdditionalUseStep in API graphs
This commit is contained in:
@@ -388,6 +388,23 @@ module API {
|
||||
API::Node getNode() { result = root().getASuccessor(Label::entryPoint(this)) }
|
||||
}
|
||||
|
||||
/**
|
||||
* A class for contributing new steps for tracking uses of an API.
|
||||
*/
|
||||
class AdditionalUseStep extends Unit {
|
||||
/**
|
||||
* Holds if use nodes should flow from `pred` to `succ`.
|
||||
*/
|
||||
predicate step(DataFlow::SourceNode pred, DataFlow::SourceNode succ) { none() }
|
||||
}
|
||||
|
||||
private module AdditionalUseStep {
|
||||
pragma[nomagic]
|
||||
predicate step(DataFlow::SourceNode pred, DataFlow::SourceNode succ) {
|
||||
any(AdditionalUseStep st).step(pred, succ)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the actual implementation of API graphs, cached for performance.
|
||||
*
|
||||
@@ -751,6 +768,11 @@ module API {
|
||||
boundArgs in [0 .. 10]
|
||||
)
|
||||
or
|
||||
exists(DataFlow::SourceNode mid |
|
||||
mid = trackUseNode(nd, promisified, boundArgs, prop, t) and
|
||||
AdditionalUseStep::step(pragma[only_bind_out](mid), result)
|
||||
)
|
||||
or
|
||||
exists(DataFlow::Node pred, string preprop |
|
||||
trackUseNode(nd, promisified, boundArgs, preprop, t.continue()).flowsTo(pred) and
|
||||
promisified = false and
|
||||
|
||||
Reference in New Issue
Block a user