@@ -20,7 +20,9 @@ private module log {
20
20
* See https://docs.python.org/3/library/logging.html#logger-objects
21
21
*/
22
22
private class LogOutputMethods extends string {
23
- LogOutputMethods ( ) { this in [ "info" , "error" , "warn" , "warning" , "debug" , "critical" ] }
23
+ LogOutputMethods ( ) {
24
+ this in [ "info" , "error" , "warn" , "warning" , "debug" , "critical" , "exception" , "log" ]
25
+ }
24
26
}
25
27
26
28
/**
@@ -33,7 +35,13 @@ private module log {
33
35
this = API:: moduleImport ( "logging" ) .getMember ( any ( LogOutputMethods m ) ) .getACall ( )
34
36
}
35
37
36
- override DataFlow:: Node getAnInput ( ) { result = this .getArg ( _) }
38
+ override DataFlow:: Node getAnInput ( ) {
39
+ this .getFunction ( ) .( DataFlow:: AttrRead ) .getAttributeName ( ) != "log" and
40
+ result = this .getArg ( 0 )
41
+ or
42
+ this .getFunction ( ) .( DataFlow:: AttrRead ) .getAttributeName ( ) = "log" and
43
+ result = this .getArg ( 1 )
44
+ }
37
45
}
38
46
39
47
/**
@@ -51,7 +59,13 @@ private module log {
51
59
.getACall ( )
52
60
}
53
61
54
- override DataFlow:: Node getAnInput ( ) { result = this .getArg ( _) }
62
+ override DataFlow:: Node getAnInput ( ) {
63
+ this .getFunction ( ) .( DataFlow:: AttrRead ) .getAttributeName ( ) != "log" and
64
+ result = this .getArg ( 0 )
65
+ or
66
+ this .getFunction ( ) .( DataFlow:: AttrRead ) .getAttributeName ( ) = "log" and
67
+ result = this .getArg ( 1 )
68
+ }
55
69
}
56
70
57
71
/**
@@ -68,7 +82,13 @@ private module log {
68
82
.getACall ( )
69
83
}
70
84
71
- override DataFlow:: Node getAnInput ( ) { result = this .getArg ( _) }
85
+ override DataFlow:: Node getAnInput ( ) {
86
+ this .getFunction ( ) .( DataFlow:: AttrRead ) .getAttributeName ( ) != "log" and
87
+ result = this .getArg ( 0 )
88
+ or
89
+ this .getFunction ( ) .( DataFlow:: AttrRead ) .getAttributeName ( ) = "log" and
90
+ result = this .getArg ( 1 )
91
+ }
72
92
}
73
93
74
94
/**
@@ -87,6 +107,12 @@ private module log {
87
107
.getACall ( )
88
108
}
89
109
90
- override DataFlow:: Node getAnInput ( ) { result = this .getArg ( _) }
110
+ override DataFlow:: Node getAnInput ( ) {
111
+ this .getFunction ( ) .( DataFlow:: AttrRead ) .getAttributeName ( ) != "log" and
112
+ result = this .getArg ( 0 )
113
+ or
114
+ this .getFunction ( ) .( DataFlow:: AttrRead ) .getAttributeName ( ) = "log" and
115
+ result = this .getArg ( 1 )
116
+ }
91
117
}
92
118
}
0 commit comments