Merge pull request #2751 from Ryex/security/modrith-hash-priority
Prefer stronger hashes from Modrinth
This commit is contained in:
commit
1bb7f35ddb
@ -348,14 +348,14 @@ bool ModrinthCreationTask::parseManifest(const QString& index_path,
|
|||||||
QJsonObject hashes = Json::requireObject(modInfo, "hashes");
|
QJsonObject hashes = Json::requireObject(modInfo, "hashes");
|
||||||
QString hash;
|
QString hash;
|
||||||
QCryptographicHash::Algorithm hashAlgorithm;
|
QCryptographicHash::Algorithm hashAlgorithm;
|
||||||
hash = Json::ensureString(hashes, "sha1");
|
|
||||||
hashAlgorithm = QCryptographicHash::Sha1;
|
|
||||||
if (hash.isEmpty()) {
|
|
||||||
hash = Json::ensureString(hashes, "sha512");
|
hash = Json::ensureString(hashes, "sha512");
|
||||||
hashAlgorithm = QCryptographicHash::Sha512;
|
hashAlgorithm = QCryptographicHash::Sha512;
|
||||||
if (hash.isEmpty()) {
|
if (hash.isEmpty()) {
|
||||||
hash = Json::ensureString(hashes, "sha256");
|
hash = Json::ensureString(hashes, "sha256");
|
||||||
hashAlgorithm = QCryptographicHash::Sha256;
|
hashAlgorithm = QCryptographicHash::Sha256;
|
||||||
|
if (hash.isEmpty()) {
|
||||||
|
hash = Json::ensureString(hashes, "sha1");
|
||||||
|
hashAlgorithm = QCryptographicHash::Sha1;
|
||||||
if (hash.isEmpty()) {
|
if (hash.isEmpty()) {
|
||||||
throw JSONValidationError("No hash found for: " + file.path);
|
throw JSONValidationError("No hash found for: " + file.path);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user