Revert "Reject weak hash algorithms as SRIs, and warn in any other cases"
This reverts commit 02c35ea9df.
Reason for revert: this code path is also used for `Input::getRev()`, i.e. flakes VCS revision validation, which, in the case of Git, are using SHA1.
As a result, this cause too much noise due to SHA1 revisions in Flakes.
Change-Id: I8064c1ebc26e4e83b627f0803a7a9ba56cfe1f37
This commit is contained in:
committed by
Gerrit Code Review
parent
02c35ea9df
commit
6e2349d2e1
@@ -8,7 +8,6 @@
|
||||
#include "hash.hh"
|
||||
#include "archive.hh"
|
||||
#include "charptr-cast.hh"
|
||||
#include "fmt.hh"
|
||||
#include "logging.hh"
|
||||
#include "split.hh"
|
||||
#include "strings.hh"
|
||||
@@ -211,17 +210,6 @@ Hash Hash::parseNonSRIUnprefixed(std::string_view s, HashType type)
|
||||
Hash::Hash(std::string_view rest, HashType type, bool isSRI)
|
||||
: Hash(type)
|
||||
{
|
||||
if (type == HashType::MD5 || type == HashType::SHA1) {
|
||||
if (isSRI) {
|
||||
// Forbidden as per https://w3c.github.io/webappsec-csp/#grammardef-hash-algorithm
|
||||
throw BadHash("%s values are not allowed in SRI hashes", printHashType(type));
|
||||
} else {
|
||||
logWarning({
|
||||
.msg = HintFmt("%s hashes are considered weak, use a newer hashing algorithm instead. (value: %s)", Uncolored(printHashType(type)), rest)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (!isSRI && rest.size() == base16Len()) {
|
||||
|
||||
auto parseHexDigit = [&](char c) {
|
||||
|
||||
Reference in New Issue
Block a user