Skip to content

Commit e6f9ef5

Browse files
authored
Merge pull request #15643 from owen-mc/java/sensitive-logging
Java: Sensitive Logging: Simplify definition of source and improve QLDoc
2 parents ea67646 + 22692b9 commit e6f9ef5

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

java/ql/lib/semmle/code/java/security/SensitiveLoggingQuery.qll

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@ import semmle.code.java.frameworks.android.Compose
88
private import semmle.code.java.security.Sanitizers
99

1010
/** A variable that may hold sensitive information, judging by its name. */
11-
class CredentialExpr extends Expr {
11+
class VariableWithSensitiveName extends Variable {
12+
VariableWithSensitiveName() { this.getName().regexpMatch(getCommonSensitiveInfoRegex()) }
13+
}
14+
15+
/** A reference to a variable that may hold sensitive information, judging by its name. */
16+
class CredentialExpr extends VarAccess {
1217
CredentialExpr() {
13-
exists(Variable v | this = v.getAnAccess() |
14-
v.getName().regexpMatch(getCommonSensitiveInfoRegex()) and
15-
not this instanceof CompileTimeConstantExpr
16-
)
18+
this.getVariable() instanceof VariableWithSensitiveName and
19+
not this instanceof CompileTimeConstantExpr
1720
}
1821
}
1922

0 commit comments

Comments
 (0)