Skip to content

Commit 781ae31

Browse files
committed
Port over UI5PathInjection
- Port over UI5PathInjection. - Create a UI5PathInjectionQuery file and move the configuration there. - Update expected results of the query.
1 parent 7a9f335 commit 781ae31

File tree

5 files changed

+17
-15
lines changed

5 files changed

+17
-15
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import javascript
2+
3+
module UI5PathInjection implements DataFlow::ConfigSig {
4+
predicate isSource(DataFlow::Node node) { node instanceof RemoteFlowSource }
5+
6+
predicate isSink(DataFlow::Node node) {
7+
node = ModelOutput::getASinkNode("ui5-path-injection").asSink()
8+
}
9+
}

javascript/frameworks/ui5/src/UI5PathInjection/UI5PathInjection.ql

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,20 @@
1414

1515
import javascript
1616
import advanced_security.javascript.frameworks.ui5.dataflow.DataFlow
17-
import advanced_security.javascript.frameworks.ui5.dataflow.DataFlow::UI5PathGraph
17+
import advanced_security.javascript.frameworks.ui5.UI5PathInjectionQuery
1818

19-
// import semmle.javascript.security.dataflow.TaintedPathQuery as TaintedPathQuery
20-
class UI5PathInjectionConfiguration extends TaintTracking::Configuration {
21-
UI5PathInjectionConfiguration() { this = "UI5 Path Injection" }
19+
module UI5PathInjectionFlow = TaintTracking::Global<UI5PathInjection>;
2220

23-
override predicate isSource(DataFlow::Node node) { node instanceof RemoteFlowSource }
21+
module UI5PathInjectionPathGraph =
22+
UI5PathGraph<UI5PathInjectionFlow::PathNode, UI5PathInjectionFlow::PathGraph>;
2423

25-
override predicate isSink(DataFlow::Node node) {
26-
node = ModelOutput::getASinkNode("ui5-path-injection").asSink()
27-
}
28-
}
24+
import UI5PathInjectionPathGraph
2925

3026
from
31-
UI5PathInjectionConfiguration config, UI5PathNode source, UI5PathNode sink,
32-
UI5PathNode primarySource
27+
UI5PathInjectionPathGraph::UI5PathNode source, UI5PathInjectionPathGraph::UI5PathNode sink,
28+
UI5PathInjectionPathGraph::UI5PathNode primarySource
3329
where
34-
config.hasFlowPath(source.getPathNode(), sink.getPathNode()) and
30+
UI5PathInjectionFlow::flowPath(source.getPathNode(), sink.getPathNode()) and
3531
primarySource = source.getAPrimarySource()
3632
select sink, primarySource, sink, "The path of a saved file depends on a $@.", primarySource,
3733
"user-provided value"

javascript/frameworks/ui5/test/queries/UI5PathInjection/path-custom-control-property-sanitized/UI5PathInjection.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
WARNING: type 'Configuration' has been deprecated and may be removed in future (UI5PathInjection.ql:20,45-73)
21
nodes
32
| webapp/control/xss.js:8:23:8:37 | { type: "int" } |
43
| webapp/control/xss.js:17:43:17:60 | oControl.getText() |

javascript/frameworks/ui5/test/queries/UI5PathInjection/path-custom-control-sanitized/UI5PathInjection.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
WARNING: type 'Configuration' has been deprecated and may be removed in future (UI5PathInjection.ql:20,45-73)
21
nodes
32
| webapp/control/xss.js:9:23:9:40 | { type: "string" } |
43
| webapp/control/xss.js:15:21:15:46 | value |

javascript/frameworks/ui5/test/queries/UI5PathInjection/path-html-control-df/UI5PathInjection.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
WARNING: type 'Configuration' has been deprecated and may be removed in future (UI5PathInjection.ql:20,45-73)
21
nodes
32
| webapp/controller/app.controller.js:10:17:10:27 | input: null |
43
| webapp/controller/app.controller.js:16:39:16:66 | oModel. ... input') |

0 commit comments

Comments
 (0)