@@ -2,7 +2,7 @@ private import python
2
2
private import semmle.python.dataflow.new.DataFlow
3
3
private import experimental.semmle.python.Concepts
4
4
private import semmle.python.ApiGraphs
5
- private import semmle.python.dataflow.new.TaintTracking2
5
+ private import semmle.python.dataflow.new.TaintTracking
6
6
7
7
module SmtpLib {
8
8
/** Gets a reference to `smtplib.SMTP_SSL` */
@@ -31,16 +31,16 @@ module SmtpLib {
31
31
* argument. Used because of the impossibility to get local source nodes from `_subparts`'
32
32
* `(List|Tuple)` elements.
33
33
*/
34
- private class SmtpMessageConfig extends TaintTracking2 :: Configuration {
35
- SmtpMessageConfig ( ) { this = "SMTPMessageConfig" }
34
+ private module SmtpMessageConfig implements DataFlow :: ConfigSig {
35
+ predicate isSource ( DataFlow :: Node source ) { source = mimeText ( _ ) }
36
36
37
- override predicate isSource ( DataFlow:: Node source ) { source = mimeText ( _) }
38
-
39
- override predicate isSink ( DataFlow:: Node sink ) {
37
+ predicate isSink ( DataFlow:: Node sink ) {
40
38
sink = smtpMimeMultipartInstance ( ) .getACall ( ) .getArgByName ( "_subparts" )
41
39
}
42
40
}
43
41
42
+ module SmtpMessageFlow = TaintTracking:: Global< SmtpMessageConfig > ;
43
+
44
44
/**
45
45
* Using the `MimeText` call retrieves the content argument whose type argument equals `mimetype`.
46
46
* This call flows into `MIMEMultipart`'s `_subparts` argument or the `.attach()` method call
@@ -87,8 +87,7 @@ module SmtpLib {
87
87
sink =
88
88
[ sendCall .getArg ( 2 ) , sendCall .getArg ( 2 ) .( DataFlow:: MethodCallNode ) .getObject ( ) ]
89
89
.getALocalSource ( ) and
90
- any ( SmtpMessageConfig a )
91
- .hasFlow ( source , sink .( DataFlow:: CallCfgNode ) .getArgByName ( "_subparts" ) )
90
+ SmtpMessageFlow:: flow ( source , sink .( DataFlow:: CallCfgNode ) .getArgByName ( "_subparts" ) )
92
91
or
93
92
// via .attach()
94
93
sink = smtpMimeMultipartInstance ( ) .getReturn ( ) .getMember ( "attach" ) .getACall ( ) and
0 commit comments