Skip to content

Commit 909ce39

Browse files
committed
Put back LogArgumentToListener to FlowSteps.qll and reference it in the query
1 parent f541012 commit 909ce39

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

javascript/frameworks/ui5/lib/advanced_security/javascript/frameworks/ui5/UI5LogsToHttpQuery.qll

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,11 @@ module UI5LogEntryToHttp implements DataFlow::StateConfigSig {
2929
UI5LogInjection::isAdditionalFlowStep(start, end) and
3030
preState = postState
3131
or
32-
/*
33-
* Jump from any argument of a SAP logging function to the `onLogEntry`
34-
* method of a custom log listener in the same application.
35-
*/
36-
37-
inSameWebApp(start.getFile(), end.getFile()) and
38-
start =
39-
ModelOutput::getATypeNode("SapLogger")
40-
.getMember(["debug", "error", "fatal", "info", "trace", "warning"])
41-
.getACall()
42-
.getAnArgument() and
43-
end = ModelOutput::getATypeNode("SapLogEntries").asSource() and
44-
preState = "not-logged-not-accessed" and
45-
postState = "logged-and-accessed"
32+
exists(LogArgumentToListener logArgumentToListener |
33+
logArgumentToListener.step(start, end) and
34+
preState = "not-logged-not-accessed" and
35+
postState = "logged-and-accessed"
36+
)
4637
}
4738

4839
predicate isSink(DataFlow::Node node, FlowState state) {

javascript/frameworks/ui5/lib/advanced_security/javascript/frameworks/ui5/dataflow/FlowSteps.qll

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,4 +341,20 @@ class ResourceBundleGetTextCallArgToReturnValueStep extends DataFlow::SharedFlow
341341
end = getTextCall
342342
)
343343
}
344-
}
344+
}
345+
346+
/**
347+
* A step from any argument of a SAP logging function to the `onLogEntry`
348+
* method of a custom log listener in the same application.
349+
*/
350+
class LogArgumentToListener extends DataFlow::SharedFlowStep {
351+
override predicate step(DataFlow::Node start, DataFlow::Node end) {
352+
inSameWebApp(start.getFile(), end.getFile()) and
353+
start =
354+
ModelOutput::getATypeNode("SapLogger")
355+
.getMember(["debug", "error", "fatal", "info", "trace", "warning"])
356+
.getACall()
357+
.getAnArgument() and
358+
end = ModelOutput::getATypeNode("SapLogEntries").asSource()
359+
}
360+
}

0 commit comments

Comments
 (0)