@@ -7,6 +7,9 @@ import semmle.code.java.security.SensitiveActions
77import semmle.code.java.frameworks.android.Compose
88private import semmle.code.java.security.Sanitizers
99
10+ /** A data flow source node for sensitive logging sources. */
11+ abstract class SensitiveLoggerSource extends DataFlow:: Node { }
12+
1013/** A variable that may hold sensitive information, judging by its name. */
1114class VariableWithSensitiveName extends Variable {
1215 VariableWithSensitiveName ( ) {
@@ -26,6 +29,10 @@ class CredentialExpr extends VarAccess {
2629 }
2730}
2831
32+ private class CredentialExprSource extends SensitiveLoggerSource {
33+ CredentialExprSource ( ) { this .asExpr ( ) instanceof CredentialExpr }
34+ }
35+
2936/** An instantiation of a (reflexive, transitive) subtype of `java.lang.reflect.Type`. */
3037private class TypeType extends RefType {
3138 pragma [ nomagic]
@@ -42,7 +49,7 @@ private class TypeType extends RefType {
4249deprecated class SensitiveLoggerConfiguration extends TaintTracking:: Configuration {
4350 SensitiveLoggerConfiguration ( ) { this = "SensitiveLoggerConfiguration" }
4451
45- override predicate isSource ( DataFlow:: Node source ) { source . asExpr ( ) instanceof CredentialExpr }
52+ override predicate isSource ( DataFlow:: Node source ) { source instanceof SensitiveLoggerSource }
4653
4754 override predicate isSink ( DataFlow:: Node sink ) { sinkNode ( sink , "log-injection" ) }
4855
@@ -59,7 +66,7 @@ deprecated class SensitiveLoggerConfiguration extends TaintTracking::Configurati
5966
6067/** A data-flow configuration for identifying potentially-sensitive data flowing to a log output. */
6168module SensitiveLoggerConfig implements DataFlow:: ConfigSig {
62- predicate isSource ( DataFlow:: Node source ) { source . asExpr ( ) instanceof CredentialExpr }
69+ predicate isSource ( DataFlow:: Node source ) { source instanceof SensitiveLoggerSource }
6370
6471 predicate isSink ( DataFlow:: Node sink ) { sinkNode ( sink , "log-injection" ) }
6572
0 commit comments