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

check integrity of downloaded files #321

Open
adrelanos opened this issue Jun 14, 2023 · 0 comments
Open

check integrity of downloaded files #321

adrelanos opened this issue Jun 14, 2023 · 0 comments

Comments

@adrelanos
Copy link

Threat model:

  • website is more trusted
  • mirrors / CDNs are less trusted

Under this threat model it would make sense if something similar to subresource integrity could be used.

<script
  src="https://example.com/example-framework.js"
  integrity="sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC"
  crossorigin="anonymous"></script>

Unfortunately, subresource integrity does not support user downloaded files at the of writing. Ticket: w3c/webappsec-subresource-integrity#68
And from the ticket it also doesn't seem like support for that is coming anytime soon.

Meanwhile would it be possible to do integrity check with javascript? Could the javascript look at the download stream, run it through "$sha512" [1] hashing and notify at the end of the download if the hashsum matches or mismatches?

Tails implemented a similar solution. References:

The disadvantage is, that the user has to:

  1. complete the download
  2. click at the Verify your download button
  3. select the file
  4. press ok
  5. wait for the verification to be completed

That's non-ideal from a usability perspective.

feature request:
Could StreamSaver.js automate this?


[1] Writing $ sha512 because that's just a placeholder for "hashing algorithm". Shouldn't be hardcoded to be future-proof.

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

No branches or pull requests

1 participant