Skip to content

Commit f8e474f

Browse files
committed
Add missing java.nio.file.Files methods to FileReadWrite.qll
1 parent 163257a commit f8e474f

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

java/ql/src/semmle/code/java/security/FileReadWrite.qll

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ private predicate fileRead(VarAccess fileAccess, Expr fileReadingExpr) {
99
cie = fileReadingExpr and
1010
cie.getArgument(0) = fileAccess
1111
|
12-
cie.getConstructedType().hasQualifiedName("java.io", "RandomAccessFile") or
13-
cie.getConstructedType().hasQualifiedName("java.io", "FileReader") or
14-
cie.getConstructedType().hasQualifiedName("java.io", "FileInputStream")
12+
cie
13+
.getConstructedType()
14+
.hasQualifiedName("java.io", ["RandomAccessFile", "FileReader", "FileInputStream"])
1515
)
1616
or
1717
exists(MethodAccess ma, Method filesMethod |
@@ -22,13 +22,9 @@ private predicate fileRead(VarAccess fileAccess, Expr fileReadingExpr) {
2222
// represented by the first argument.
2323
filesMethod.getDeclaringType().hasQualifiedName("java.nio.file", "Files") and
2424
fileAccess = ma.getArgument(0) and
25-
(
26-
filesMethod.hasName("readAllBytes") or
27-
filesMethod.hasName("readAllLines") or
28-
filesMethod.hasName("newBufferedReader") or
29-
filesMethod.hasName("newInputReader") or
30-
filesMethod.hasName("newByteChannel")
31-
)
25+
filesMethod
26+
.hasName(["readAllBytes", "readAllLines", "readString", "lines", "newBufferedReader",
27+
"newInputReader", "newByteChannel"])
3228
)
3329
)
3430
or

0 commit comments

Comments
 (0)