@@ -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,12 @@ class CredentialExpr extends VarAccess {
26
29
}
27
30
}
28
31
32
+ class CredentialExprSource extends SensitiveLoggerSource {
33
+ CredentialExprSource ( ) {
34
+ this .asExpr ( ) instanceof CredentialExpr
35
+ }
36
+ }
37
+
29
38
/** An instantiation of a (reflexive, transitive) subtype of `java.lang.reflect.Type`. */
30
39
private class TypeType extends RefType {
31
40
pragma [ nomagic]
@@ -42,7 +51,7 @@ private class TypeType extends RefType {
42
51
deprecated class SensitiveLoggerConfiguration extends TaintTracking:: Configuration {
43
52
SensitiveLoggerConfiguration ( ) { this = "SensitiveLoggerConfiguration" }
44
53
45
- override predicate isSource ( DataFlow:: Node source ) { source . asExpr ( ) instanceof CredentialExpr }
54
+ override predicate isSource ( DataFlow:: Node source ) { source instanceof SensitiveLoggerSource }
46
55
47
56
override predicate isSink ( DataFlow:: Node sink ) { sinkNode ( sink , "log-injection" ) }
48
57
@@ -59,7 +68,7 @@ deprecated class SensitiveLoggerConfiguration extends TaintTracking::Configurati
59
68
60
69
/** A data-flow configuration for identifying potentially-sensitive data flowing to a log output. */
61
70
module SensitiveLoggerConfig implements DataFlow:: ConfigSig {
62
- predicate isSource ( DataFlow:: Node source ) { source . asExpr ( ) instanceof CredentialExpr }
71
+ predicate isSource ( DataFlow:: Node source ) { sourc instanceof SensitiveLoggerSource }
63
72
64
73
predicate isSink ( DataFlow:: Node sink ) { sinkNode ( sink , "log-injection" ) }
65
74
0 commit comments