mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Locally these seem to get rid of the compilation warnings, but of course CI is the true arbiter here.
39 lines
1.1 KiB
Plaintext
39 lines
1.1 KiB
Plaintext
import javascript
|
|
import semmle.javascript.dataflow.FlowSummary
|
|
|
|
overlay[local]
|
|
class MkSummary extends SummarizedCallable {
|
|
private CallExpr mkSummary;
|
|
|
|
MkSummary() {
|
|
mkSummary.getCalleeName() = "mkSummary" and
|
|
this =
|
|
"mkSummary at " + mkSummary.getFile().getRelativePath() + ":" +
|
|
mkSummary.getLocation().getStartLine()
|
|
}
|
|
|
|
override DataFlow::InvokeNode getACallSimple() {
|
|
result = mkSummary.flow().(DataFlow::CallNode).getAnInvocation()
|
|
}
|
|
|
|
override predicate propagatesFlow(string input, string output, boolean preservesValue) {
|
|
preservesValue = true and
|
|
(
|
|
// mkSummary(input, output)
|
|
input = mkSummary.getArgument(0).getStringValue() and
|
|
output = mkSummary.getArgument(1).getStringValue()
|
|
or
|
|
// mkSummary([
|
|
// [input1, output1],
|
|
// [input2, output2],
|
|
// ...
|
|
// ])
|
|
exists(ArrayExpr pair |
|
|
pair = mkSummary.getArgument(0).(ArrayExpr).getAnElement() and
|
|
input = pair.getElement(0).getStringValue() and
|
|
output = pair.getElement(1).getStringValue()
|
|
)
|
|
)
|
|
}
|
|
}
|