|
12 | 12 | */ |
13 | 13 |
|
14 | 14 | import javascript |
| 15 | +import advanced_security.javascript.frameworks.ui5.UI5LogsToHttpQuery |
15 | 16 | import advanced_security.javascript.frameworks.ui5.dataflow.DataFlow |
16 | | -import semmle.javascript.frameworks.data.internal.ApiGraphModels |
17 | | -import advanced_security.javascript.frameworks.ui5.UI5LogInjectionQuery |
18 | | -import advanced_security.javascript.frameworks.ui5.dataflow.DataFlow::UI5PathGraph |
19 | 17 |
|
20 | | -class ClientRequestInjectionVector extends DataFlow::Node { |
21 | | - ClientRequestInjectionVector() { |
22 | | - exists(ClientRequest req | |
23 | | - this = req.getUrl() or |
24 | | - this = req.getADataNode() |
25 | | - ) |
26 | | - } |
27 | | -} |
| 18 | +module UI5LogsToHttpFlow = TaintTracking::GlobalWithState<UI5LogEntryToHttp>; |
28 | 19 |
|
29 | | -class UI5LogEntryFlowState extends DataFlow::FlowLabel { |
30 | | - UI5LogEntryFlowState() { this = ["not-logged-not-accessed", "logged-and-accessed"] } |
31 | | -} |
| 20 | +module UI5LogsToHttpUI5PathGraph = |
| 21 | + UI5PathGraph<UI5LogsToHttpFlow::PathNode, UI5LogsToHttpFlow::PathGraph>; |
32 | 22 |
|
33 | | -class UI5LogEntryToHttp extends TaintTracking::Configuration { |
34 | | - UI5LogEntryToHttp() { this = "UI5 Log Entry included in an outbound HTTP request" } |
| 23 | +import UI5LogsToHttpUI5PathGraph |
35 | 24 |
|
36 | | - override predicate isSource(DataFlow::Node node, DataFlow::FlowLabel state) { |
37 | | - node instanceof RemoteFlowSource and |
38 | | - state = "not-logged-not-accessed" |
39 | | - } |
40 | | - |
41 | | - override predicate isAdditionalFlowStep( |
42 | | - DataFlow::Node start, DataFlow::Node end, DataFlow::FlowLabel preState, |
43 | | - DataFlow::FlowLabel postState |
44 | | - ) { |
45 | | - exists(UI5LogInjectionConfiguration cfg | |
46 | | - cfg.isAdditionalFlowStep(start, end) and |
47 | | - preState = postState |
48 | | - ) |
49 | | - or |
50 | | - /* |
51 | | - * NOTE: This disjunct is a labeled version of LogArgumentToListener in |
52 | | - * FlowSteps.qll, a DataFlow::SharedFlowStep. As the class is considered |
53 | | - * legacy on version 2.4.0, we leave the two here (labeled) and there |
54 | | - * (unlabeled). This is something we should also tidy up when we migrate |
55 | | - * to the newer APIs. |
56 | | - */ |
57 | | - |
58 | | - inSameWebApp(start.getFile(), end.getFile()) and |
59 | | - start = |
60 | | - ModelOutput::getATypeNode("SapLogger") |
61 | | - .getMember(["debug", "error", "fatal", "info", "trace", "warning"]) |
62 | | - .getACall() |
63 | | - .getAnArgument() and |
64 | | - end = ModelOutput::getATypeNode("SapLogEntries").asSource() and |
65 | | - preState = "not-logged-not-accessed" and |
66 | | - postState = "logged-and-accessed" |
67 | | - } |
68 | | - |
69 | | - override predicate isSink(DataFlow::Node node, DataFlow::FlowLabel state) { |
70 | | - node instanceof ClientRequestInjectionVector and |
71 | | - state = "logged-and-accessed" |
72 | | - } |
73 | | -} |
74 | | - |
75 | | -from UI5LogEntryToHttp cfg, UI5PathNode source, UI5PathNode sink, UI5PathNode primarySource |
| 25 | +from |
| 26 | + UI5LogsToHttpUI5PathGraph::UI5PathNode source, UI5LogsToHttpUI5PathGraph::UI5PathNode sink, |
| 27 | + UI5LogsToHttpUI5PathGraph::UI5PathNode primarySource |
76 | 28 | where |
77 | | - cfg.hasFlowPath(source.getPathNode(), sink.getPathNode()) and |
| 29 | + UI5LogsToHttpFlow::flowPath(source.getPathNode(), sink.getPathNode()) and |
78 | 30 | primarySource = source.getAPrimarySource() |
79 | 31 | select sink, primarySource, sink, "Outbound network request depends on $@ log data.", primarySource, |
80 | 32 | "user-provided" |
0 commit comments