gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
75.47k stars 7.5k forks source link

Generate integrity hashes #4990

Closed ghost closed 6 years ago

ghost commented 6 years ago

I'd like to be able to generate the value of an integrity attribute in my hugo template given a hashing function, e.g.

<script async scr={{ "js/script.js" | relURL }} integrity={{ sha384 (string.ToBinary (readFile "/static/js/script.js") | base64Encode }}>

There are some openssl bindings for Go though I'm not sure they'd be required if a binary representation of the read file contents can be generated during the build as shown above with the fictitious string.ToBinary function. Having the capability to generate integrity attributes would help themes developers provide additional security for their users and eliminate this job:

https://github.com/gcushen/hugo-academic/blob/master/data/sri.toml#L16-L18

bep commented 6 years ago

See https://gohugo.io/hugo-pipes/fingerprint/

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.