#29490: Subresource integrity for form assets
---------------------------------------+------------------------
Reporter: Meiyer | Owner: nobody
Type: New feature | Status: new
Component: Forms | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------+------------------------
[https://developer.mozilla.org/en-
US/docs/Web/Security/Subresource_Integrity SRI] gives the web site author
some guarantees that an external resource (typically, a script), included
within the web page, has not been altered. For example, various external
libraries are loaded from a CDN or another third-party repository,
implicitly trusting that repositories’ security, but these libraries can
be modified or tampered with to include malicious code, with the web site
author not aware that this malicious code is now running on their web site
in the context of their own web application. SRI prevents the loading of
such resources if they were modified.
SRI is implemented by the means of the “integrity” attribute on the
`<LINK>` and `<SCRIPT>` HTML elements. It is relevant to Django, because
the form assets (“Media”) may point to resources on external repositories.
But Django does not allow any way to specify the
[https://developer.mozilla.org/en-
US/docs/Web/Security/Subresource_Integrity#Using_Subresource_Integrity
“integrity“ attribute] (and the [https://developer.mozilla.org/en-
US/docs/Web/HTML/CORS_settings_attributes “crossorigin” attribute]) for
the assets of the forms.
I suggest modifying the `Media`
[https://docs.djangoproject.com/en/2.0/topics/forms/media/#assets-as-a
-static-definition class definitions] such that the assets are not a
simple list but a `dict` (with keys such as `src`, `integrity`,
`crossorigin`), resulting in corresponding HTML elements being rendered
appropriately. There can be a fallback to the simpler case when a `list`
or `tuple` is provided, for backwards-compatibility.
--
Ticket URL: <https://code.djangoproject.com/ticket/29490>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.4acd3484d842e90614b0fd421f3f1fa6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.