Skip to content

Commit 41e7b91

Browse files
committed
fix flowLabels
1 parent f41bc1f commit 41e7b91

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

javascript/ql/src/experimental/Security/CWE-094-dataURL/CodeInjection.ql

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ class WorkerThreads extends DataFlow::Node {
5353
}
5454
}
5555

56-
class WorkerThreadsLabel extends FlowLabel {
57-
WorkerThreadsLabel() { this = "worker_threads" }
56+
class URLConstructorLabel extends FlowLabel {
57+
URLConstructorLabel() { this = "URLConstructorLabel" }
5858
}
5959

6060
class DynamicImportLabel extends FlowLabel {
@@ -67,15 +67,12 @@ class DynamicImportLabel extends FlowLabel {
6767
class Configuration extends TaintTracking::Configuration {
6868
Configuration() { this = "CodeInjection" }
6969

70-
override predicate isSource(DataFlow::Node source, FlowLabel label) {
71-
source instanceof RemoteFlowSource and
72-
(label instanceof DynamicImportLabel or label instanceof WorkerThreadsLabel)
73-
}
70+
override predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
71+
72+
override predicate isSink(DataFlow::Node sink) { sink instanceof DynamicImport }
7473

7574
override predicate isSink(DataFlow::Node sink, FlowLabel label) {
76-
sink instanceof DynamicImport and label instanceof DynamicImportLabel
77-
or
78-
sink instanceof WorkerThreads and label instanceof WorkerThreadsLabel
75+
sink instanceof WorkerThreads and label instanceof URLConstructorLabel
7976
}
8077

8178
override predicate isSanitizer(DataFlow::Node node) { node instanceof Sanitizer }
@@ -87,8 +84,8 @@ class Configuration extends TaintTracking::Configuration {
8784
newUrl = DataFlow::globalVarRef("URL").getAnInstantiation() and
8885
pred = newUrl.getArgument(0)
8986
) and
90-
predlbl instanceof WorkerThreadsLabel and
91-
succlbl instanceof WorkerThreadsLabel
87+
predlbl instanceof StandardFlowLabel and
88+
succlbl instanceof URLConstructorLabel
9289
}
9390
}
9491

0 commit comments

Comments
 (0)