Skip to content

Commit fbc03f5

Browse files
committed
Port over UI5FormulaInjection
1 parent dbcdcbf commit fbc03f5

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ import advanced_security.javascript.frameworks.ui5.dataflow.DataFlow
88
private class StoragePutCall extends CallNode {
99
StoragePutCall() {
1010
/* 1. This is a call to `sap.ui.util.Storage.put` */
11-
// 1-1. Required from `sap/ui/util/Storage`
11+
/* 1-1. Required from `sap/ui/util/Storage` */
1212
exists(RequiredObject storageClass |
1313
this.getReceiver().getALocalSource() = storageClass.asSourceNode() and
1414
this.getCalleeName() = "put"
1515
)
1616
or
17-
// 1-2. Direct call to `sap.ui.util.Storage.put`
17+
/* 1-2. Direct call to `sap.ui.util.Storage.put` */
1818
this =
1919
globalVarRef("sap")
2020
.getAPropertyRead("ui")
@@ -109,12 +109,10 @@ private class FileSaveCall extends CallNode {
109109
}
110110
}
111111

112-
class UI5FormulaInjectionConfiguration extends TaintTracking::Configuration {
113-
UI5FormulaInjectionConfiguration() { this = "UI5 Formula Injection" }
112+
module UI5FormulaInjection implements DataFlow::ConfigSig {
113+
predicate isSource(DataFlow::Node node) { node instanceof RemoteFlowSource }
114114

115-
override predicate isSource(DataFlow::Node node) { node instanceof RemoteFlowSource }
116-
117-
override predicate isSink(DataFlow::Node node) {
115+
predicate isSink(DataFlow::Node node) {
118116
exists(StoragePutCall storagePutCall | node = storagePutCall.getArgument(1))
119117
or
120118
exists(FileSaveCall fileSaveCall |

javascript/frameworks/ui5/src/UI5FormulaInjection/UI5FormulaInjection.ql

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,21 @@
1313

1414
import javascript
1515
import advanced_security.javascript.frameworks.ui5.dataflow.DataFlow
16-
import advanced_security.javascript.frameworks.ui5.dataflow.DataFlow::UI5PathGraph
1716
import advanced_security.javascript.frameworks.ui5.UI5FormulaInjectionQuery
1817

18+
module UI5FormulaInjectionFlow = TaintTracking::Global<UI5FormulaInjection>;
19+
20+
module UI5FormulaInjectionUI5PathGraph =
21+
UI5PathGraph<UI5FormulaInjectionFlow::PathNode, UI5FormulaInjectionFlow::PathGraph>;
22+
23+
import UI5FormulaInjectionUI5PathGraph
24+
1925
from
20-
UI5FormulaInjectionConfiguration config, UI5PathNode source, UI5PathNode sink,
21-
UI5PathNode primarySource
26+
UI5FormulaInjectionUI5PathGraph::UI5PathNode source,
27+
UI5FormulaInjectionUI5PathGraph::UI5PathNode sink,
28+
UI5FormulaInjectionUI5PathGraph::UI5PathNode primarySource
2229
where
23-
config.hasFlowPath(source.getPathNode(), sink.getPathNode()) and
30+
UI5FormulaInjectionFlow::flowPath(source.getPathNode(), sink.getPathNode()) and
2431
primarySource = source.getAPrimarySource()
2532
select sink, primarySource, sink, "The content of a saved file depends on a $@.", primarySource,
2633
"user-provided value"

0 commit comments

Comments
 (0)