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 Django CSP nonce support #989
base: develop
Are you sure you want to change the base?
Conversation
fa64da7
to
81f63a6
Compare
@diox Added tests and confirmed working in online mode. Just working on somethings for offline mode. Can you please check if you agree with the approach. About offline mode, there are 2 options:
|
81f63a6
to
a115361
Compare
Confirmed to be working in offline mode |
@diox Ping? |
Sorry for the delay, been busy with other stuff. I haven't tried this yet but it looks good on the surface. Regarding offline, I am not sure why you'd want a specific tag or setting. Actually I'm not even sure you need One improvement I think you should do is have a method in the |
I remember that it was needed in offline compression because at the time, context does not have a nonce. If there is an alternative, I'll implement it. About the method in |
I think the setting can be replaced by detecting if there is a nonce in the original content or not. |
Hmm, how will we detect that? If I match |
Also, the setting gives you the ability to not write nonce in each and every javascript/CSS and get nonce in the output as evident in the test |
We already have an HTML parser involved when compressing, so we can extract the necessary info in a reliable way and pass it down from there. |
Any ideas when this will be PR change will take effect? I am looking forward to this since my site uses django-csp. |
I haven't got enough time to finalize the requested changes after last review, however we are already using it in a production app without any issues. I will still see if I can get some time to change the implementation |
@iamareebjamal @diox Wanted to bump this, any ideas if/when this PR could be merged? Thanks. |
The conflicts would need to be solved and my suggestion from #989 (comment) implemented before we could consider merging this. |
Hi @diox |
The logic from that PR could be re-used in a custom class and templates inheriting from compressor. Besides that I don't know. You're welcome to try to pick that PR up again and re-submit it with my comments addressed (crediting original submitter). |
Fixes #946