Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SHA-1 to subresource integrity format for download() checksums #12777

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ public static Checksum fromSubresourceIntegrity(String integrity) {
byte[] hash = null;
int expectedLength = 0;

if (integrity.startsWith("sha1-")) {
keyType = KeyType.SHA1;
expectedLength = 20;
meisterT marked this conversation as resolved.
Show resolved Hide resolved
hash = decoder.decode(integrity.substring(5));
}
if (integrity.startsWith("sha256-")) {
keyType = KeyType.SHA256;
expectedLength = 32;
Expand All @@ -63,7 +68,7 @@ public static Checksum fromSubresourceIntegrity(String integrity) {
throw new IllegalArgumentException(
"Unsupported checksum algorithm: '"
+ integrity
+ "' (expected SHA-256, SHA-384, or SHA-512)");
+ "' (expected SHA-1, SHA-256, SHA-384, or SHA-512)");
}

if (hash.length != expectedLength) {
Expand Down