Skip to content

Commit f8425b8

Browse files
committed
Java: Update uses.
1 parent db0500b commit f8425b8

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

java/ql/src/Security/CWE/CWE-327/BrokenCryptoAlgorithm.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ private class ShortStringLiteral extends StringLiteral {
2121

2222
class BrokenAlgoLiteral extends ShortStringLiteral {
2323
BrokenAlgoLiteral() {
24-
getValue().regexpMatch(algorithmBlacklistRegex()) and
24+
getValue().regexpMatch(getInsecureAlgorithmRegex()) and
2525
// Exclude German and French sentences.
2626
not getValue().regexpMatch(".*\\p{IsLowercase} des \\p{IsLetter}.*")
2727
}

java/ql/src/Security/CWE/CWE-327/MaybeBrokenCryptoAlgorithm.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ class InsecureAlgoLiteral extends ShortStringLiteral {
2525
// Algorithm identifiers should be at least two characters.
2626
getValue().length() > 1 and
2727
exists(string s | s = getLiteral() |
28-
not s.regexpMatch(algorithmWhitelistRegex()) and
28+
not s.regexpMatch(getSecureAlgorithmRegex()) and
2929
// Exclude results covered by another query.
30-
not s.regexpMatch(algorithmBlacklistRegex())
30+
not s.regexpMatch(getInsecureAlgorithmRegex())
3131
)
3232
}
3333
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ string getAnInsecureHashAlgorithmName() {
112112
private string rankedAlgorithmBlacklist(int i) {
113113
// In this case we know these are being used for encryption, so we want to match
114114
// weak hash algorithms too.
115-
result = rank[i](string s | s = algorithmBlacklist() or s = hashAlgorithmBlacklist())
115+
result = rank[i](string s | s = getAnInsecureAlgorithmName() or s = getAnInsecureHashAlgorithmName())
116116
}
117117

118118
private string algorithmBlacklistString(int i) {
@@ -144,7 +144,7 @@ string getASecureAlgorithmName() {
144144
result = "ECIES"
145145
}
146146

147-
private string rankedAlgorithmWhitelist(int i) { result = rank[i](algorithmWhitelist()) }
147+
private string rankedAlgorithmWhitelist(int i) { result = rank[i](getASecureAlgorithmName()) }
148148

149149
private string algorithmWhitelistString(int i) {
150150
i = 1 and result = rankedAlgorithmWhitelist(i)

java/ql/test/library-tests/Encryption/blacklist.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import default
22
import semmle.code.java.security.Encryption
33

44
from StringLiteral s
5-
where s.getLiteral().regexpMatch(algorithmBlacklistRegex())
5+
where s.getLiteral().regexpMatch(getInsecureAlgorithmRegex())
66
select s

java/ql/test/library-tests/Encryption/whitelist.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import default
22
import semmle.code.java.security.Encryption
33

44
from StringLiteral s
5-
where s.getLiteral().regexpMatch(algorithmWhitelistRegex())
5+
where s.getLiteral().regexpMatch(getSecureAlgorithmRegex())
66
select s

0 commit comments

Comments
 (0)