Skip to content

Commit f140c13

Browse files
committed
JS: Sync ApiGraphModels.qll and update accordingly
1 parent 2b02a17 commit f140c13

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

javascript/ql/lib/semmle/javascript/frameworks/data/internal/ApiGraphModels.qll

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -436,26 +436,23 @@ module ModelOutput {
436436
}
437437

438438
/**
439-
* Holds if a relevant CSV summary row has the given `kind`, `input` and `output`.
439+
* Holds if a relevant CSV summary exists for these parameters.
440440
*/
441-
predicate summaryModel(string input, string output, string kind) {
442-
exists(string package |
443-
isRelevantPackage(package) and
444-
summaryModel(package, _, _, input, output, kind)
445-
)
441+
predicate relevantSummaryModel(
442+
string package, string type, string path, string input, string output, string kind
443+
) {
444+
isRelevantPackage(package) and
445+
summaryModel(package, type, path, input, output, kind)
446446
}
447447

448448
/**
449-
* Holds if a summary edge with the given `input, output, kind` columns have a `package, type, path` tuple
450-
* that resolves to `baseNode`.
449+
* Holds if a `baseNode` is an invocation identified by the `package,type,path` part of a summary row.
451450
*/
452451
predicate resolvedSummaryBase(
453-
Specific::InvokeNode baseNode, AccessPath input, AccessPath output, string kind
452+
string package, string type, string path, Specific::InvokeNode baseNode
454453
) {
455-
exists(string package, string type, AccessPath path |
456-
summaryModel(package, type, path, input, output, kind) and
457-
baseNode = getInvocationFromPath(package, type, path)
458-
)
454+
summaryModel(package, type, path, _, _, _) and
455+
baseNode = getInvocationFromPath(package, type, path)
459456
}
460457

461458
/**

javascript/ql/lib/semmle/javascript/frameworks/data/internal/ApiGraphModelsSpecific.qll

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,12 @@ predicate invocationMatchesExtraCallSiteFilter(API::InvokeNode invoke, AccessPat
148148
* Holds if `path` is an input or output spec for a summary with the given `base` node.
149149
*/
150150
pragma[nomagic]
151-
private predicate relevantInputOutputPath(API::InvokeNode base, AccessPath path) {
152-
ModelOutput::resolvedSummaryBase(base, path, _, _)
153-
or
154-
ModelOutput::resolvedSummaryBase(base, _, path, _)
151+
private predicate relevantInputOutputPath(API::InvokeNode base, AccessPath inputOrOutput) {
152+
exists(string package, string type, string input, string output, string path |
153+
ModelOutput::relevantSummaryModel(package, type, path, input, output, _) and
154+
ModelOutput::resolvedSummaryBase(package, type, path, base) and
155+
inputOrOutput = [input, output]
156+
)
155157
}
156158

157159
/**
@@ -179,8 +181,9 @@ private API::Node getNodeFromInputOutputPath(API::InvokeNode baseNode, AccessPat
179181
* Holds if a CSV summary contributed the step `pred -> succ` of the given `kind`.
180182
*/
181183
predicate summaryStep(API::Node pred, API::Node succ, string kind) {
182-
exists(API::InvokeNode base, AccessPath input, AccessPath output |
183-
ModelOutput::resolvedSummaryBase(base, input, output, kind) and
184+
exists(string package, string type, string path, API::InvokeNode base, AccessPath input, AccessPath output |
185+
ModelOutput::relevantSummaryModel(package, type, path, input, output, kind) and
186+
ModelOutput::resolvedSummaryBase(package, type, path, base) and
184187
pred = getNodeFromInputOutputPath(base, input) and
185188
succ = getNodeFromInputOutputPath(base, output)
186189
)

0 commit comments

Comments
 (0)