Skip to content

Commit 3b45bcd

Browse files
Esben Sparre Andreasenesbena
authored andcommitted
JS: remove the standard PoI configurations
1 parent dd6378f commit 3b45bcd

11 files changed

+46
-32
lines changed

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

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -163,37 +163,37 @@ private module StandardPoIs {
163163
)
164164
}
165165
}
166-
}
167-
168-
import StandardPoIs
169166

170-
/**
171-
* Provides often used point of interest configurations.
172-
*/
173-
private module StandardPoIConfigurations {
174167
/**
175-
* A configuration that enables some server related points of interest.
168+
* Provides groups of often used point of interest.
176169
*/
177-
abstract class ServerPoIConfiguration extends PoIConfiguration {
178-
override predicate enabled(PoI poi) {
179-
poi instanceof UnpromotedRouteSetupPoI or
180-
poi instanceof UnpromotedRouteHandlerPoI or
181-
poi instanceof UnpromotedRouteHandlerWithFlowPoI
170+
module StandardPoIGroups {
171+
/**
172+
* A server-related points of interest.
173+
*/
174+
class ServerRelatedPoI extends StandardPoI {
175+
ServerRelatedPoI() {
176+
this instanceof UnpromotedRouteSetupPoI or
177+
this instanceof UnpromotedRouteHandlerPoI or
178+
this instanceof UnpromotedRouteHandlerWithFlowPoI
179+
}
182180
}
183-
}
184181

185-
/**
186-
* A configuration that enables some `DataFlow::Configuration` related points of interest.
187-
*/
188-
abstract class DataFlowConfigurationPoIConfiguration extends PoIConfiguration {
189-
override predicate enabled(PoI poi) {
190-
poi instanceof SourcePoI or
191-
poi instanceof SinkPoI
182+
/**
183+
* A configuration-related points of interest.
184+
*/
185+
class DataFlowConfigurationPoI extends StandardPoI {
186+
DataFlowConfigurationPoI() {
187+
this instanceof SourcePoI or
188+
this instanceof SinkPoI
189+
}
192190
}
193191
}
192+
193+
import StandardPoIGroups
194194
}
195195

196-
import StandardPoIConfigurations
196+
import StandardPoIs
197197

198198
/**
199199
* A tagging interface for the standard points of interest.
@@ -213,7 +213,8 @@ private module PoIConfigDefaults {
213213
* A configuration for the points of interest to display.
214214
*/
215215
abstract class PoIConfiguration extends string {
216-
PoIConfiguration() { this = "PoIConfiguration" }
216+
bindingset[this]
217+
PoIConfiguration() { any() }
217218

218219
/**
219220
* Holds if the points of interest from `poi` should be shown.

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
WARNING: Config extends only abstract classes but does not provide its own characteristic predicate (CommandInjectionPoIConfiguration.ql:11,7-13)
21
| tst.js:16:15:16:25 | req.query.x | SourcePoI | tst.js:16:15:16:25 | req.query.x | irrelevant | tst.js:16:15:16:25 | req.query.x | irrelevant |
32
| tst.js:17:11:17:21 | req.query.x | SinkPoI | tst.js:17:11:17:21 | req.query.x | irrelevant | tst.js:17:11:17:21 | req.query.x | irrelevant |
43
| tst.js:17:11:17:21 | req.query.x | SourcePoI | tst.js:17:11:17:21 | req.query.x | irrelevant | tst.js:17:11:17:21 | req.query.x | irrelevant |

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ 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 DataFlowConfigurationPoIConfiguration { }
11+
class Config extends PoIConfiguration {
12+
Config() { this = "Config" }
13+
14+
override predicate enabled(PoI poi) { poi instanceof DataFlowConfigurationPoI }
15+
}
1216

1317
query predicate problems = alertQuery/6;
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
WARNING: Config extends only abstract classes but does not provide its own characteristic predicate (ServerPoIConfiguration.ql:8,7-13)
21
| tst.js:6:1:6:16 | (req, res) => 42 | UnpromotedRouteHandlerPoI | tst.js:6:1:6:16 | (req, res) => 42 | irrelevant | tst.js:6:1:6:16 | (req, res) => 42 | irrelevant |
32
| tst.js:6:1:6:16 | (req, res) => 42 | UnpromotedRouteHandlerWithFlowPoI: $@ | tst.js:6:1:6:16 | (req, res) => 42 | ends here | tst.js:6:1:6:16 | (req, res) => 42 | irrelevant |
43
| tst.js:13:1:13:36 | otherAp ... h", rh) | UnpromotedRouteSetupPoI | tst.js:13:1:13:36 | otherAp ... h", rh) | irrelevant | tst.js:13:1:13:36 | otherAp ... h", rh) | irrelevant |

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

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

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

1014
query predicate problems = alertQuery/6;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
WARNING: Config extends only abstract classes but does not provide its own characteristic predicate (TaintedPathPoIConfiguration.ql:9,7-13)
21
| tst.js:1:23:1:31 | "express" | SinkPoI | tst.js:1:23:1:31 | "express" | irrelevant | tst.js:1:23:1:31 | "express" | irrelevant |
32
| tst.js:2:16:2:19 | "fs" | SinkPoI | tst.js:2:16:2:19 | "fs" | irrelevant | tst.js:2:16:2:19 | "fs" | irrelevant |
43
| tst.js:3:16:3:30 | "child_process" | SinkPoI | tst.js:3:16:3:30 | "child_process" | irrelevant | tst.js:3:16:3:30 | "child_process" | irrelevant |

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

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

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

1115
query predicate problems = alertQuery/6;
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
WARNING: Config extends only abstract classes but does not provide its own characteristic predicate (TestStandardPoIs.ql:8,7-13)
21
| tst.js:6:1:6:16 | (req, res) => 42 | UnpromotedRouteHandlerPoI | tst.js:6:1:6:16 | (req, res) => 42 | irrelevant | tst.js:6:1:6:16 | (req, res) => 42 | irrelevant |

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import javascript
66
import experimental.poi.PoI
77

88
class Config extends PoIConfiguration {
9+
Config() { this = "Config" }
10+
911
override predicate enabled(PoI poi) { poi instanceof UnpromotedRouteHandlerPoI }
1012
}
1113

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
WARNING: Config extends only abstract classes but does not provide its own characteristic predicate (XssPoIConfiguration.ql:12,7-13)
21
| tst.js:16:15:16:25 | req.query.x | SourcePoI | tst.js:16:15:16:25 | req.query.x | irrelevant | tst.js:16:15:16:25 | req.query.x | irrelevant |
32
| tst.js:17:11:17:21 | req.query.x | SourcePoI | tst.js:17:11:17:21 | req.query.x | irrelevant | tst.js:17:11:17:21 | req.query.x | irrelevant |
43
| tst.js:18:12:18:22 | req.query.x | SinkPoI | tst.js:18:12:18:22 | req.query.x | irrelevant | tst.js:18:12:18:22 | req.query.x | irrelevant |

0 commit comments

Comments
 (0)