@@ -16,10 +16,14 @@ import python
16
16
import experimental.semmle.python.security.injection.RegexInjection
17
17
import DataFlow:: PathGraph
18
18
19
- from RegexInjectionFlowConfig config , DataFlow:: PathNode source , DataFlow:: PathNode sink
20
- where config .hasFlowPath ( source , sink )
19
+ from
20
+ RegexInjectionFlowConfig config , DataFlow:: PathNode source , DataFlow:: PathNode sink ,
21
+ RegexInjectionSink castedSink , Attribute methodAttribute
22
+ where
23
+ config .hasFlowPath ( source , sink ) and
24
+ castedSink = sink .getNode ( ) and
25
+ methodAttribute = castedSink .getRegexMethod ( )
21
26
select sink .getNode ( ) , source , sink ,
22
27
"$@ regular expression is constructed from a $@ and executed by $@." , sink .getNode ( ) , "This" ,
23
- source .getNode ( ) , "user-provided value" , sink .getNode ( ) ,
24
- sink .getNode ( ) .( RegexInjectionSink ) .getRegexModule ( ) + "." +
25
- sink .getNode ( ) .( RegexInjectionSink ) .getRegexMethod ( ) .getName ( )
28
+ source .getNode ( ) , "user-provided value" , methodAttribute ,
29
+ castedSink .getRegexModule ( ) + "." + methodAttribute .getName ( )
0 commit comments