Skip to content

Commit 67572bb

Browse files
authored
Merge pull request github#9193 from github/tombolton/add-counting-queries
JS: Add individual per-security-query counting queries
2 parents e9d371c + 91fa17a commit 67572bb

File tree

7 files changed

+74
-0
lines changed

7 files changed

+74
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* For internal use only.
3+
*
4+
*
5+
* Count the number of sinks and alerts for a particular dataflow config.
6+
*/
7+
8+
import javascript
9+
import evaluation.EndToEndEvaluation
10+
11+
query predicate countAlertsAndSinks(int numAlerts, int numSinks) {
12+
numAlerts =
13+
count(DataFlow::Configuration cfg, DataFlow::Node source, DataFlow::Node sink |
14+
cfg.hasFlow(source, sink) and not isFlowExcluded(source, sink)
15+
) and
16+
numSinks =
17+
count(DataFlow::Node sink |
18+
exists(DataFlow::Configuration cfg | cfg.isSink(sink) or cfg.isSink(sink, _))
19+
)
20+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* For internal use only.
3+
*
4+
*
5+
* Count the number of sinks and alerts for the `CodeInjection` security query.
6+
*/
7+
8+
import semmle.javascript.security.dataflow.CodeInjectionQuery
9+
import CountAlertsAndSinks
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* For internal use only.
3+
*
4+
*
5+
* Count the number of sinks and alerts for the `NosqlInection` security query.
6+
*/
7+
8+
import semmle.javascript.security.dataflow.NosqlInjectionQuery
9+
import CountAlertsAndSinks
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* For internal use only.
3+
*
4+
*
5+
* Count the number of sinks and alerts for the `SqlInection` security query.
6+
*/
7+
8+
import semmle.javascript.security.dataflow.SqlInjectionQuery
9+
import CountAlertsAndSinks
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* For internal use only.
3+
*
4+
*
5+
* Count the number of sinks and alerts for the `TaintedPath` security query.
6+
*/
7+
8+
import semmle.javascript.security.dataflow.TaintedPathQuery
9+
import CountAlertsAndSinks
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* For internal use only.
3+
*
4+
*
5+
* Count the number of sinks and alerts for the `DomBasedXss` security query.
6+
*/
7+
8+
import semmle.javascript.security.dataflow.DomBasedXssQuery
9+
import CountAlertsAndSinks
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* For internal use only.
3+
*
4+
*
5+
* Count the number of sinks and alerts for the `XssThroughDom` security query.
6+
*/
7+
8+
import semmle.javascript.security.dataflow.XssThroughDomQuery
9+
import CountAlertsAndSinks

0 commit comments

Comments
 (0)