Java: Update uses.

This commit is contained in:
Geoffrey White
2020-06-30 12:54:21 +01:00
parent db0500b9ef
commit f8425b8a58
5 changed files with 7 additions and 7 deletions

View File

@@ -21,7 +21,7 @@ private class ShortStringLiteral extends StringLiteral {
class BrokenAlgoLiteral extends ShortStringLiteral {
BrokenAlgoLiteral() {
getValue().regexpMatch(algorithmBlacklistRegex()) and
getValue().regexpMatch(getInsecureAlgorithmRegex()) and
// Exclude German and French sentences.
not getValue().regexpMatch(".*\\p{IsLowercase} des \\p{IsLetter}.*")
}

View File

@@ -25,9 +25,9 @@ class InsecureAlgoLiteral extends ShortStringLiteral {
// Algorithm identifiers should be at least two characters.
getValue().length() > 1 and
exists(string s | s = getLiteral() |
not s.regexpMatch(algorithmWhitelistRegex()) and
not s.regexpMatch(getSecureAlgorithmRegex()) and
// Exclude results covered by another query.
not s.regexpMatch(algorithmBlacklistRegex())
not s.regexpMatch(getInsecureAlgorithmRegex())
)
}
}

View File

@@ -112,7 +112,7 @@ string getAnInsecureHashAlgorithmName() {
private string rankedAlgorithmBlacklist(int i) {
// In this case we know these are being used for encryption, so we want to match
// weak hash algorithms too.
result = rank[i](string s | s = algorithmBlacklist() or s = hashAlgorithmBlacklist())
result = rank[i](string s | s = getAnInsecureAlgorithmName() or s = getAnInsecureHashAlgorithmName())
}
private string algorithmBlacklistString(int i) {
@@ -144,7 +144,7 @@ string getASecureAlgorithmName() {
result = "ECIES"
}
private string rankedAlgorithmWhitelist(int i) { result = rank[i](algorithmWhitelist()) }
private string rankedAlgorithmWhitelist(int i) { result = rank[i](getASecureAlgorithmName()) }
private string algorithmWhitelistString(int i) {
i = 1 and result = rankedAlgorithmWhitelist(i)