mirror of
https://github.com/github/codeql.git
synced 2026-04-24 08:15:14 +02:00
Refactor: use concat instead of hand-written version
This changes the order of the algorithms in the regex, but I don't think that makes any difference.
This commit is contained in:
@@ -235,22 +235,12 @@ string getAnInsecureHashAlgorithmName() {
|
||||
result = "MD5"
|
||||
}
|
||||
|
||||
private string rankedInsecureAlgorithm(int i) {
|
||||
result = rank[i](string name | insecureAlgorithm(name, _))
|
||||
}
|
||||
|
||||
private string insecureAlgorithmString(int i) {
|
||||
i = 1 and result = rankedInsecureAlgorithm(i)
|
||||
or
|
||||
result = rankedInsecureAlgorithm(i) + "|" + insecureAlgorithmString(i - 1)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the regular expression used for matching strings that look like they
|
||||
* contain an algorithm that is known to be insecure.
|
||||
*/
|
||||
string getInsecureAlgorithmRegex() {
|
||||
result = algorithmRegex(insecureAlgorithmString(max(int i | exists(rankedInsecureAlgorithm(i)))))
|
||||
result = algorithmRegex(concat(string name | insecureAlgorithm(name, _) | name, "|"))
|
||||
}
|
||||
|
||||
/** Gets the reason why `input` is an insecure algorithm, if any. */
|
||||
|
||||
Reference in New Issue
Block a user