-
-
Notifications
You must be signed in to change notification settings - Fork 260
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
add subresource integrity to css/js #494
Comments
Any update? |
I'm trying to work out how to make this work with This Python code can generate the hash:
To test this I use a link copied with SRI tag from cdnjs, and
This looks good, but I'm not sure how webassets integration would or should work. It would be perfect if when I define the link tag:
I could then reference a variable like But there's also the question of where I call the code to generate these hashes in the first place, and where to store them. |
Presumably this should be implemented in the jinja2 extension to expose a new variable (or use the |
This is the start of the implementation of miracle2k#494 Currently only tested on Python 3.7, missing unit tests and documentation. Basic idea is to extend the Bundle.urls() function to return a list of dictionaries {'uri': <same as before>, 'sri': <hash>} but only when requested (to not break existing users). A dict is used instead of a tuple to allow adding other values in the future. Currently only works for local resources.
I have a POC implementation, which I will extend with unit tests. I will not write any code for django etc, only jinja2 (since it is the only one I can test). Furthermore, I will not be able to test any versions of Python except 3.7 and 2.7. |
Part of implementing miracle2k#494
This makes it work better with nested bundles and removes the possibility of mixed settings. This commit also adds unit tests for the bundle class. Part of implementing miracle2k#494
Allow the creation of a signature for subresource integrity for the created files.
see: https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity
The text was updated successfully, but these errors were encountered: