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

common-updater-scripts: Support SRI-style hash #78913

Merged
merged 4 commits into from Feb 4, 2020
Merged

Conversation

jtojnar
Copy link
Contributor

@jtojnar jtojnar commented Jan 30, 2020

Some fetcher functions support SRI-style hash attribute in addition to legacy type-specific attributes. When hash is used outputHashAlgo is null so let’s complain when SRI-style hash value was not detected.

Such attributes match the form ${type}${separator}${hash}: True SRI uses dash as a separator and only supports base64, whereas Nix’s SRI-style format uses a colon and supports all the same encodings like regular hashes (16/32/64).

To keep this program reasonably simple, we will upgrade Nix’s SRI-like format to pure SRI instead of preserving it.

Relevant code:

@FRidh
Copy link
Member

FRidh commented Jan 30, 2020

Is SRI already allowed in Nixpkgs? If I am correct it's a Nix fetchurl feature.

@jtojnar
Copy link
Contributor Author

jtojnar commented Jan 30, 2020

See 267c8d6

Some fetcher functions support SRI-style `hash` attribute in addition to legacy type-specific attributes. When `hash` is used `outputHashAlgo` is null so let’s complain when SRI-style hash value was not detected.

Such attributes match the form ${type}${separator}${hash}: True SRI uses dash as a separator and only supports base64, whereas Nix’s SRI-style format uses a colon and supports all the same encodings like regular hashes (16/32/64).

To keep this program reasonably simple, we will upgrade Nix’s SRI-like format to pure SRI instead of preserving it.
Fix issues reported by shellcheck and few other style issues.

Though we need to ignore $systemArg complaints because Nix does not support passing --system as a single argument.
We can check some things before the modifications take place.
@jtojnar jtojnar merged commit f40a8a0 into NixOS:master Feb 4, 2020
@jtojnar jtojnar deleted the cus-fixes branch February 4, 2020 23:47
dtzWill pushed a commit to dtzWill/nixpkgs that referenced this pull request Feb 5, 2020
common-updater-scripts: Support SRI-style hash
(cherry picked from commit f40a8a0)
@worldofpeace
Copy link
Contributor

Thanks for adding this @jtojnar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants