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

Script not blocked when integrity attribute is malformed ? #120

Open
MarchantLucas opened this issue Feb 15, 2023 · 2 comments
Open

Script not blocked when integrity attribute is malformed ? #120

MarchantLucas opened this issue Feb 15, 2023 · 2 comments

Comments

@MarchantLucas
Copy link

Knowing that subresource integrity is a security feature, I would expect that when the value of the attribute "integrity" is malformed, the script/stylesheet supposed to be loaded would be blocked. But if I forget to specify the algorithm (shaXXX) and write anything for the hash value(correct or false one) then the integrity attribute is ignored and the ressource is loaded. Why did you choose this implementation ?

As an example : in this program, the ressource won't be blocked :

<link rel="stylesheet"
      href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
      integrity="not_a_good_hash"
      crossorigin="anonymous">


<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
        integrity="Also_Not_A_GOOD_HASH"
        crossorigin="anonymous"></script>
@annevk
Copy link
Member

annevk commented Feb 15, 2023

While there's room for improvement here (see #84), there's reason to ignore unrecognized hash algorithms: https://w3c.github.io/webappsec-subresource-integrity/#agility.

Perhaps it would have been worth it to consider the case of it not containing any supported hash algorithms in a special manner, but that might also make agility more cumbersome in practice.

@MarchantLucas
Copy link
Author

Ok, so it's an efficiency/compatibility-oriented choice ? Thank you Anne !

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

2 participants