|
12 | 12 |
|
13 | 13 | import javascript |
14 | 14 | import advanced_security.javascript.frameworks.ui5.dataflow.DataFlow |
15 | | -import advanced_security.javascript.frameworks.ui5.dataflow.DataFlow::UI5PathGraph |
16 | | -import semmle.javascript.security.dataflow.LogInjectionQuery as LogInjection |
| 15 | +import advanced_security.javascript.frameworks.ui5.UI5UnsafeLogAccessQuery |
17 | 16 |
|
18 | | -class UI5LogInjectionConfiguration extends LogInjection::LogInjectionConfiguration { |
19 | | - override predicate isSource(DataFlow::Node node) { node instanceof RemoteFlowSource } |
| 17 | +module UI5UnsafeLogAccessFlow = TaintTracking::Global<UI5UnsafeLogAccess>; |
20 | 18 |
|
21 | | - override predicate isSink(DataFlow::Node node) { |
22 | | - node = ModelOutput::getASinkNode("ui5-log-injection").asSink() |
23 | | - } |
24 | | -} |
| 19 | +module UI5UnsafeLogAccessFlowUI5PathGraph = |
| 20 | + UI5PathGraph<UI5UnsafeLogAccessFlow::PathNode, UI5UnsafeLogAccessFlow::PathGraph>; |
25 | 21 |
|
26 | | -private newtype TLogEntriesNode = |
27 | | - TDataFlowNode(DataFlow::Node node) { |
28 | | - node = ModelOutput::getATypeNode("SapLogEntries").getInducingNode() |
29 | | - } or |
30 | | - TUI5ControlNode(UI5Control control) { control.getImportPath() = "sap/ui/vk/Notifications" } |
31 | | - |
32 | | -class LogEntriesNode extends TLogEntriesNode { |
33 | | - DataFlow::Node asDataFlowNode() { this = TDataFlowNode(result) } |
34 | | - |
35 | | - UI5Control asUI5ControlNode() { this = TUI5ControlNode(result) } |
36 | | - |
37 | | - File getFile() { |
38 | | - result = this.asDataFlowNode().getFile() |
39 | | - or |
40 | | - result = this.asUI5ControlNode().getView() |
41 | | - } |
42 | | - |
43 | | - string toString() { |
44 | | - result = this.asDataFlowNode().toString() |
45 | | - or |
46 | | - result = this.asUI5ControlNode().toString() |
47 | | - } |
48 | | - |
49 | | - predicate hasLocationInfo( |
50 | | - string filepath, int startline, int startcolumn, int endline, int endcolumn |
51 | | - ) { |
52 | | - this.asDataFlowNode().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) |
53 | | - or |
54 | | - this.asUI5ControlNode().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) |
55 | | - } |
56 | | -} |
| 22 | +import UI5UnsafeLogAccessFlowUI5PathGraph |
57 | 23 |
|
58 | 24 | from |
59 | | - UI5LogInjectionConfiguration cfg, UI5PathNode source, UI5PathNode sink, UI5PathNode primarySource, |
60 | | - LogEntriesNode logEntries |
| 25 | + UI5UnsafeLogAccessFlowUI5PathGraph::UI5PathNode source, |
| 26 | + UI5UnsafeLogAccessFlowUI5PathGraph::UI5PathNode sink, |
| 27 | + UI5UnsafeLogAccessFlowUI5PathGraph::UI5PathNode primarySource, LogEntriesNode logEntries |
61 | 28 | where |
62 | | - cfg.hasFlowPath(source.getPathNode(), sink.getPathNode()) and |
| 29 | + UI5UnsafeLogAccessFlow::flowPath(source.getPathNode(), sink.getPathNode()) and |
63 | 30 | primarySource = source.getAPrimarySource() and |
64 | 31 | inSameWebApp(source.getFile(), logEntries.getFile()) |
65 | 32 | select logEntries, primarySource, sink, "Accessed log entries depend on $@.", primarySource, |
|
0 commit comments