mirror of
https://github.com/github/codeql.git
synced 2026-04-25 08:45:14 +02:00
Merge pull request #15643 from owen-mc/java/sensitive-logging
Java: Sensitive Logging: Simplify definition of source and improve QLDoc
This commit is contained in:
@@ -8,12 +8,15 @@ import semmle.code.java.frameworks.android.Compose
|
||||
private import semmle.code.java.security.Sanitizers
|
||||
|
||||
/** A variable that may hold sensitive information, judging by its name. */
|
||||
class CredentialExpr extends Expr {
|
||||
class VariableWithSensitiveName extends Variable {
|
||||
VariableWithSensitiveName() { this.getName().regexpMatch(getCommonSensitiveInfoRegex()) }
|
||||
}
|
||||
|
||||
/** A reference to a variable that may hold sensitive information, judging by its name. */
|
||||
class CredentialExpr extends VarAccess {
|
||||
CredentialExpr() {
|
||||
exists(Variable v | this = v.getAnAccess() |
|
||||
v.getName().regexpMatch(getCommonSensitiveInfoRegex()) and
|
||||
not this instanceof CompileTimeConstantExpr
|
||||
)
|
||||
this.getVariable() instanceof VariableWithSensitiveName and
|
||||
not this instanceof CompileTimeConstantExpr
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user