-
Notifications
You must be signed in to change notification settings - Fork 144
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 support for Content-Security-Policy #391
Comments
Good catch could you please open a Pull Request with this relevant security feature? I think that this would be something for release 1.9.0 if you agree |
Thanks for your support, I opened #392, which currently contains yet untested code. For documentation I could not find a suitable spot at first glance, maybe add it to the FAQ? |
thank you for the amazing report and the quick and concrete code proposal I requested three changes in your PR just related to the project and not to your code. if you feel comfortable in having it in the FAQ please include it in the FAQ |
Make sure djangosaml2 works in csp-enabled applications too (fix #391)
SAML with POST-Bindings has inherent problems with Content-Security-Policies being in-place: The three views
LoginView
,LogoutView
andLogoutInitView
all need at leastform-action https:
and probablyscript-src 'unsafe-inline'
to autostart redirection.Gladly,
django-csp
exists and allows for quite easy setting of these headers, so if an application activates them, djangosaml2 won't work any longer due to CSP restrictions being enabled. As most users probably do not want to enableunsafe-inline
and form-action to any https-site, djangosaml2 should update the values like using@csp_update(SCRIPT_SRC=["'unsafe-inline'"], FORM_ACTION=["https:"])
.My current implementation as a quickfix is btw:
instead of
If one were to implement this properly, one option would probably be to do something like
The text was updated successfully, but these errors were encountered: