Skip to content

Commit a0e6562

Browse files
committed
JS: address review feedback
1 parent 2747e2a commit a0e6562

File tree

6 files changed

+9
-33
lines changed

6 files changed

+9
-33
lines changed

javascript/ql/src/experimental/poi/PoI.qll

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* in an unknown code base.
44
*
55
* To use this module, subclass the
6-
* `PoI` class, override *one* of its `is` predicates, and use
6+
* `ActivePoI` class, override *one* of its `is` predicates, and use
77
* `alertQuery` as a `@kind problem` query . This will present
88
* the desired points of interest as alerts that are easily browsable
99
* in a codeql IDE. By itself, this is no different from an ordinary
@@ -14,7 +14,7 @@
1414
* - this module comes with a collection of standard points of interest (see `StandardPoIs`)
1515
*
1616
* A global configuration for the points of interest (see
17-
* `PoIConfg`) can be used to easily manage multiple points of
17+
* `PoIConfiguration`) can be used to easily manage multiple points of
1818
* interests, and to restrict the points of interest to specific
1919
* corners of the code base.
2020
*
@@ -300,15 +300,11 @@ predicate alertQuery(Locatable l1line, string msg, Node l2, string s2, Node l3,
300300
(
301301
not exists(PoIConfiguration cfg) and
302302
PoIConfigDefaults::enabled(poi) and
303-
PoIConfigDefaults::shown(l1) and
304-
PoIConfigDefaults::shown(l2) and
305-
PoIConfigDefaults::shown(l3)
303+
PoIConfigDefaults::shown(l1)
306304
or
307305
exists(PoIConfiguration cfg |
308306
cfg.enabled(poi) and
309-
cfg.shown(l1) and
310-
cfg.shown(l2) and
311-
cfg.shown(l3)
307+
cfg.shown(l1)
312308
)
313309
) and
314310
m = poi.getFormat() and

javascript/ql/test/experimental/PoI/CommandInjectionPoIConfiguration.ql

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ import semmle.javascript.security.dataflow.CommandInjection
88
import semmle.javascript.security.dataflow.IndirectCommandInjection
99
import semmle.javascript.security.dataflow.ShellCommandInjectionFromEnvironment
1010

11-
class Config extends PoIConfiguration {
12-
Config() { this = "Config" }
13-
14-
override predicate enabled(PoI poi) { poi instanceof DataFlowConfigurationPoI }
15-
}
11+
class MyDataFlowConfigurationPoIs extends DataFlowConfigurationPoI, ActivePoI { }
1612

1713
query predicate problems = alertQuery/6;

javascript/ql/test/experimental/PoI/ServerPoIConfiguration.ql

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
import javascript
66
import experimental.poi.PoI
77

8-
class Config extends PoIConfiguration {
9-
Config() { this = "Config" }
10-
11-
override predicate enabled(PoI poi) { poi instanceof ServerRelatedPoI }
12-
}
8+
class MyServerRelatedPoIs extends ServerRelatedPoI, ActivePoI { }
139

1410
query predicate problems = alertQuery/6;

javascript/ql/test/experimental/PoI/TaintedPathPoIConfiguration.ql

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ import javascript
66
import experimental.poi.PoI
77
import semmle.javascript.security.dataflow.TaintedPath
88

9-
class Config extends PoIConfiguration {
10-
Config() { this = "Config" }
11-
12-
override predicate enabled(PoI poi) { poi instanceof DataFlowConfigurationPoI }
13-
}
9+
class MyDataflowRelatedPoIs extends DataFlowConfigurationPoI, ActivePoI { }
1410

1511
query predicate problems = alertQuery/6;

javascript/ql/test/experimental/PoI/TestStandardPoIs.ql

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
import javascript
66
import experimental.poi.PoI
77

8-
class Config extends PoIConfiguration {
9-
Config() { this = "Config" }
10-
11-
override predicate enabled(PoI poi) { poi instanceof UnpromotedRouteHandlerPoI }
12-
}
8+
class MyUnpromotedRouteHandlerPoIs extends UnpromotedRouteHandlerPoI, ActivePoI { }
139

1410
query predicate problems = alertQuery/6;

javascript/ql/test/experimental/PoI/XssPoIConfiguration.ql

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ import semmle.javascript.security.dataflow.StoredXss
99
import semmle.javascript.security.dataflow.DomBasedXss
1010
import semmle.javascript.security.dataflow.ExceptionXss
1111

12-
class Config extends PoIConfiguration {
13-
Config() { this = "Config" }
14-
15-
override predicate enabled(PoI poi) { poi instanceof DataFlowConfigurationPoI }
16-
}
12+
class MyDataFlowConfigurationPoIs extends DataFlowConfigurationPoI, ActivePoI { }
1713

1814
query predicate problems = alertQuery/6;

0 commit comments

Comments
 (0)