Skip to content

Commit 6f03a0b

Browse files
authored
Merge pull request github#3487 from luchua-bc/java-sensitive-jboss-logging
Add JBoss logging
2 parents c36e621 + 69f2525 commit 6f03a0b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

java/ql/src/experimental/CWE-532/SensitiveInfoLog.ql

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import PathGraph
1616
* Gets a regular expression for matching names of variables that indicate the value being held is a credential
1717
*/
1818
private string getACredentialRegex() {
19-
result = "(?i).*pass(wd|word|code|phrase)(?!.*question).*" or
19+
result = "(?i).*challenge|pass(wd|word|code|phrase)(?!.*question).*" or
2020
result = "(?i)(.*username|url).*"
2121
}
2222

@@ -31,14 +31,19 @@ class CredentialExpr extends Expr {
3131
class LoggerType extends RefType {
3232
LoggerType() {
3333
this.hasQualifiedName("org.apache.log4j", "Category") or //Log4J
34-
this.hasQualifiedName("org.slf4j", "Logger") //SLF4j and Gradle Logging
34+
this.hasQualifiedName("org.slf4j", "Logger") or //SLF4j and Gradle Logging
35+
this.hasQualifiedName("org.jboss.logging", "BasicLogger") //JBoss Logging
3536
}
3637
}
3738

3839
predicate isSensitiveLoggingSink(DataFlow::Node sink) {
3940
exists(MethodAccess ma |
4041
ma.getMethod().getDeclaringType() instanceof LoggerType and
41-
(ma.getMethod().hasName("debug") or ma.getMethod().hasName("trace")) and //Check low priority log levels which are more likely to be real issues to reduce false positives
42+
(
43+
ma.getMethod().hasName("debug") or
44+
ma.getMethod().hasName("trace") or
45+
ma.getMethod().hasName("debugf")
46+
) and //Check low priority log levels which are more likely to be real issues to reduce false positives
4247
sink.asExpr() = ma.getAnArgument()
4348
)
4449
}

0 commit comments

Comments
 (0)