@@ -86,17 +86,15 @@ predicate underAValue(DataFlow::GuardNode g, ControlFlowNode node, boolean branc
86
86
)
87
87
}
88
88
89
- class Configuration extends TaintTracking :: Configuration {
90
- Configuration ( ) { this = "RemoteSourcesReachUnicodeCharacters" }
89
+ private module UnicodeDoSConfig implements DataFlow :: ConfigSig {
90
+ predicate isSource ( DataFlow :: Node source ) { source instanceof RemoteFlowSource }
91
91
92
- override predicate isSource ( DataFlow:: Node source ) { source instanceof RemoteFlowSource }
93
-
94
- override predicate isSanitizer ( DataFlow:: Node sanitizer ) {
92
+ predicate isBarrier ( DataFlow:: Node sanitizer ) {
95
93
// underAValue is a check to ensure that the length of the user-provided value is limited to a certain amount
96
94
sanitizer = DataFlow:: BarrierGuard< underAValue / 3 > :: getABarrierNode ( )
97
95
}
98
96
99
- override predicate isSink ( DataFlow:: Node sink ) {
97
+ predicate isSink ( DataFlow:: Node sink ) {
100
98
// Any call to the Unicode compatibility normalization is a costly operation
101
99
sink = any ( UnicodeCompatibilityNormalize ucn ) .getPathArg ( )
102
100
or
@@ -113,9 +111,11 @@ class Configuration extends TaintTracking::Configuration {
113
111
}
114
112
}
115
113
116
- import DataFlow:: PathGraph
114
+ module UnicodeDoSFlow = TaintTracking:: Global< UnicodeDoSConfig > ;
115
+
116
+ import UnicodeDoSFlow:: PathGraph
117
117
118
- from Configuration config , DataFlow :: PathNode source , DataFlow :: PathNode sink
119
- where config . hasFlowPath ( source , sink )
118
+ from UnicodeDoSFlow :: PathNode source , UnicodeDoSFlow :: PathNode sink
119
+ where UnicodeDoSFlow :: flowPath ( source , sink )
120
120
select sink .getNode ( ) , source , sink , "This $@ can reach a $@." , source .getNode ( ) ,
121
121
"user-provided value" , sink .getNode ( ) , "costly Unicode normalization operation"
0 commit comments