Skip to content

Conversation

@tymees
Copy link
Member

@tymees tymees commented Jul 23, 2025

As promised, I looked into the possible Django-CSP and DjangoSAML2 issues. Turns out, nothing is broken!

So this PR is limited to a few minor changes related to all this:

  • Updated the dev-project to use Django CSP 4
  • Fixed an issue in DjangoSAML2 in which it could forget it's session locally
  • Updated the requirements to explicitly require a DjangoSAML2 version compatible with Django-CSP 4

Comment on lines +249 to +251
if not SESSION_COOKIE_SECURE:
# Needed on dev
SAML_SESSION_COOKIE_SAMESITE = 'Lax'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is the fix about forgetting sessions I talked about.

If this is not here, the SAML library doesn't set it's session cookie in local dev environments. (Because by default this requires the session-cookie secure flag to be set).

I would recommend apps to set something similar

@tymees tymees requested a review from miggol July 23, 2025 10:32
@tymees
Copy link
Member Author

tymees commented Jul 23, 2025

Oh, btw, the new version of DjangoSAML2 is compatible with Django CSP < 4 as well. So the mandatory upgrade should not break apps with a < 4 constraint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants