Skip to content

Commit 6d3fdc3

Browse files
committed
all forms considered+ more unicode normalize sink
1 parent 083cd61 commit 6d3fdc3

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

python/ql/lib/semmle/python/security/dataflow/UnicodeBypassValidationQuery.qll

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,20 @@ class Configuration extends TaintTracking::Configuration {
5454
override predicate isSink(DataFlow::Node sink, DataFlow::FlowState state) {
5555
exists(API::CallNode cn |
5656
cn = API::moduleImport("unicodedata").getMember("normalize").getACall() and
57-
cn.getArg(0).asExpr().(Str).getS() = ["NFC", "NFKC"] and
58-
sink = cn.getArg(1) and
59-
state instanceof PostValidation
60-
)
57+
sink = cn.getArg(1)
58+
or
59+
cn = API::moduleImport("unidecode").getMember("unidecode").getACall() and
60+
sink = cn.getArg(0)
61+
or
62+
cn = API::moduleImport("pyunormalize").getMember(["NFC", "NFD", "NFKC", "NFKD"]).getACall() and
63+
sink = cn.getArg(0)
64+
or
65+
cn = API::moduleImport("pyunormalize").getMember(["normalize"]).getACall() and
66+
sink = cn.getArg(1)
67+
or
68+
cn = API::moduleImport("textnorm").getMember(["normalize_unicode"]).getACall() and
69+
sink = cn.getArg(0)
70+
) and
71+
state instanceof PostValidation
6172
}
6273
}

0 commit comments

Comments
 (0)