Simplify definition of source and improve QLDoc

This is also slightly faster to evaluate (217s instead of 228s on apache/geode on my machine).
This commit is contained in:
Owen Mansel-Chan
2024-02-16 16:47:41 +00:00
parent c6f4a204e9
commit 22692b9d55

View File

@@ -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
}
}