You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're using the csp.extensions.NoncedScript extension in our Jinja templates and it has been very useful. We would love if there was a similar template tag that we could use for inline styles as well.
The text was updated successfully, but these errors were encountered:
Thanks @GergelyKalmar - makes sense and doesn't look too big a lift. I'm triaging things at the moment, but first thought is that this could be good one as a small contribution, so will label it and see if anyone is interested
I took a different approach to solve this problem on my own.
In my tools package, I created a render_nonce_attr function that will render a nonce attribute, provided you'll pass it the request in the jinja template:
Also, I've committed significant upgrades to the django-webpack project, as well as the django-debug-toolbar, and others I don't remember off the top of my head. If you you look at the KToolsDjangoExtension I linked in the first link, there are even more helpers for CSP stuff, for example the Form.Media renderer that will add nonces to form media tags, provided you wrap them up.
The tools are free to be used, I put it to good use in many of my own projects.
We're using the
csp.extensions.NoncedScript
extension in our Jinja templates and it has been very useful. We would love if there was a similar template tag that we could use for inline styles as well.The text was updated successfully, but these errors were encountered: