@@ -86,17 +86,15 @@ predicate underAValue(DataFlow::GuardNode g, ControlFlowNode node, boolean branc
8686 )
8787}
8888
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 }
9191
92- override predicate isSource ( DataFlow:: Node source ) { source instanceof RemoteFlowSource }
93-
94- override predicate isSanitizer ( DataFlow:: Node sanitizer ) {
92+ predicate isBarrier ( DataFlow:: Node sanitizer ) {
9593 // underAValue is a check to ensure that the length of the user-provided value is limited to a certain amount
9694 sanitizer = DataFlow:: BarrierGuard< underAValue / 3 > :: getABarrierNode ( )
9795 }
9896
99- override predicate isSink ( DataFlow:: Node sink ) {
97+ predicate isSink ( DataFlow:: Node sink ) {
10098 // Any call to the Unicode compatibility normalization is a costly operation
10199 sink = any ( UnicodeCompatibilityNormalize ucn ) .getPathArg ( )
102100 or
@@ -113,9 +111,11 @@ class Configuration extends TaintTracking::Configuration {
113111 }
114112}
115113
116- import DataFlow:: PathGraph
114+ module UnicodeDoSFlow = TaintTracking:: Global< UnicodeDoSConfig > ;
115+
116+ import UnicodeDoSFlow:: PathGraph
117117
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 )
120120select sink .getNode ( ) , source , sink , "This $@ can reach a $@." , source .getNode ( ) ,
121121 "user-provided value" , sink .getNode ( ) , "costly Unicode normalization operation"
0 commit comments