3 ms·
HTTP SRI Subresource Integrity allows for specifying which cryptographic hash is presented, like ld-proofs has a "future-proof" signatureSuite attribute : http
by westurner 4y ago
HTTP SRI Subresource Integrity allows for specifying which cryptographic hash is presented, like ld-proofs has a "future-proof" signatureSuite attribute :
https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity https://developer.mozilla.org/en-US/docs/Web/Security/Subres...
> Subresource Integrity with the <script> element
> You can use the following <script> element to tell a browser that before executing the https://example.com/example-framework.js https://example.com/example-framework.js script, the browser must first compare the script to the expected hash, and verify that there's a match.
<script
src="https://example.com/example-framework.js"
integrity="sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC"
crossorigin="anonymous"></script>
[...]
Note: An integrity value may contain multiple hashes separated by whitespace. A resource will be loaded if it matches one of those hashes
To create a SHA384 SRI HTTP resource hash for the integrity= attr:
cat FILENAME.js | openssl dgst -sha384 -binary | openssl base64 -A
- bArray 4y ago(Assuming this is not already solved in a way I do not know...) Extending your example, would it be possible to have: <a href="https://example.com/data.bin" integrity="sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC" >link</a> I think this would be useful to have the browser check the integrity of the linked content, rather than asking the user to do it. You could have the hashsum being performed as the file is being downloaded. I think we would then want to the browser to indicate that the link actually has this integrity check, although it would be difficult to do in a way that cannot be easily spoofed. You could have something happen on hover over, but this won't work for touch devices.
- westurner 4y agoAdding support for the he integrity= SRI attribute on <a> tags probably does make sense. Copying and pasting doesn't copy integrity= node attribute, but does copy URL query arguments and URI fragments.