Skip to content

Commit d772bb2

Browse files
committed
Added three more Unicode Normalization sinks
1 parent 90c174d commit d772bb2

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

ruby/ql/lib/codeql/ruby/experimental/UnicodeBypassValidationQuery.qll

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,30 @@ class Configuration extends TaintTracking::Configuration {
8181

8282
/* A Unicode Tranformation (Unicode tranformation) is considered a sink when the algorithm used is either NFC or NFKC. */
8383
override predicate isSink(DataFlow::Node sink, DataFlow::FlowState state) {
84-
exists(DataFlow::CallNode cn |
85-
cn.getMethodName() = "unicode_normalize" and
86-
cn.getArgument(0).getConstantValue().getSymbol() = ["nfkc", "nfc", "nfkd", "nfd"] and
87-
sink = cn.getReceiver()
84+
(
85+
exists(DataFlow::CallNode cn |
86+
cn.getMethodName() = "unicode_normalize" and
87+
cn.getArgument(0).getConstantValue().getSymbol() = ["nfkc", "nfc", "nfkd", "nfd"] and
88+
sink = cn.getReceiver()
89+
)
90+
or
91+
// unicode_utils
92+
exists(API::MethodAccessNode mac |
93+
mac = API::getTopLevelMember("UnicodeUtils").getMethod(["nfkd", "nfc", "nfd", "nfkc"]) and
94+
sink = mac.getParameter(0).asSink()
95+
)
96+
or
97+
// eprun
98+
exists(API::MethodAccessNode mac |
99+
mac = API::getTopLevelMember("Eprun").getMethod("normalize") and
100+
sink = mac.getParameter(0).asSink()
101+
)
102+
or
103+
// unf
104+
exists(API::MethodAccessNode mac |
105+
mac = API::getTopLevelMember("UNF").getMember("Normalizer").getMethod("normalize") and
106+
sink = mac.getParameter(0).asSink()
107+
)
88108
) and
89109
state instanceof PostValidation
90110
}

0 commit comments

Comments
 (0)