@@ -7,6 +7,9 @@ import semmle.code.java.security.SensitiveActions
7
7
import semmle.code.java.frameworks.android.Compose
8
8
private import semmle.code.java.security.Sanitizers
9
9
10
+ /** A data flow source node for sensitive logging sources. */
11
+ abstract class SensitiveLoggerSource extends DataFlow:: Node { }
12
+
10
13
/** A variable that may hold sensitive information, judging by its name. */
11
14
class VariableWithSensitiveName extends Variable {
12
15
VariableWithSensitiveName ( ) {
@@ -26,6 +29,10 @@ class CredentialExpr extends VarAccess {
26
29
}
27
30
}
28
31
32
+ private class CredentialExprSource extends SensitiveLoggerSource {
33
+ CredentialExprSource ( ) { this .asExpr ( ) instanceof CredentialExpr }
34
+ }
35
+
29
36
/** An instantiation of a (reflexive, transitive) subtype of `java.lang.reflect.Type`. */
30
37
private class TypeType extends RefType {
31
38
pragma [ nomagic]
@@ -42,7 +49,7 @@ private class TypeType extends RefType {
42
49
deprecated class SensitiveLoggerConfiguration extends TaintTracking:: Configuration {
43
50
SensitiveLoggerConfiguration ( ) { this = "SensitiveLoggerConfiguration" }
44
51
45
- override predicate isSource ( DataFlow:: Node source ) { source . asExpr ( ) instanceof CredentialExpr }
52
+ override predicate isSource ( DataFlow:: Node source ) { source instanceof SensitiveLoggerSource }
46
53
47
54
override predicate isSink ( DataFlow:: Node sink ) { sinkNode ( sink , "log-injection" ) }
48
55
@@ -59,7 +66,7 @@ deprecated class SensitiveLoggerConfiguration extends TaintTracking::Configurati
59
66
60
67
/** A data-flow configuration for identifying potentially-sensitive data flowing to a log output. */
61
68
module SensitiveLoggerConfig implements DataFlow:: ConfigSig {
62
- predicate isSource ( DataFlow:: Node source ) { source . asExpr ( ) instanceof CredentialExpr }
69
+ predicate isSource ( DataFlow:: Node source ) { source instanceof SensitiveLoggerSource }
63
70
64
71
predicate isSink ( DataFlow:: Node sink ) { sinkNode ( sink , "log-injection" ) }
65
72
0 commit comments