Skip to content

Commit bf0123d

Browse files
committed
Add org.apache.commons.lang.RandomStringUtils as a source
1 parent 1daa83b commit bf0123d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,21 @@ private class JavaRandomSource extends WeakRandomnessSource {
2929
}
3030
}
3131

32+
private class ApacheRandomStringUtilsMethodAccessSource extends WeakRandomnessSource {
33+
ApacheRandomStringUtilsMethodAccessSource() {
34+
exists(MethodAccess ma | this.asExpr() = ma |
35+
ma.getMethod()
36+
.hasName([
37+
"random", "randomAlphabetic", "randomAlphanumeric", "randomAscii", "randomGraph",
38+
"randomNumeric", "randomPrint"
39+
]) and
40+
ma.getMethod()
41+
.getDeclaringType()
42+
.hasQualifiedName("org.apache.commons.lang", "RandomStringUtils")
43+
)
44+
}
45+
}
46+
3247
/**
3348
* The `random` method of `java.lang.Math`.
3449
*/

0 commit comments

Comments
 (0)