mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
JS: Add test to restrict dependencies
This commit is contained in:
@@ -0,0 +1 @@
|
||||
| pass |
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Test that fails with a compilation error if `getACallSimple` depends on the call graph.
|
||||
* To do this, we add a negative dependency from the call graph to `getACallSimple`.
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import semmle.javascript.dataflow.internal.StepSummary
|
||||
import semmle.javascript.dataflow.FlowSummary
|
||||
|
||||
class NegativeDependency extends DataFlow::SharedTypeTrackingStep {
|
||||
override predicate step(DataFlow::Node node1, DataFlow::Node node2) {
|
||||
exists(SummarizedCallable callable |
|
||||
not exists(callable.getACallSimple()) and
|
||||
node1 = node2
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
select "pass"
|
||||
Reference in New Issue
Block a user