Skip to content

Conversation

maxfenv
Copy link
Contributor

@maxfenv maxfenv commented May 20, 2025

As of version 4.0 of django-csp, the behavior of the object that wraps the nonce in the request and/or context has changed. Testing for truthiness now returns False instead of True.

The truthiness check is unnecessary anyway, skipping it is compatible with all versions of django-csp. Probably more performant too, template rendering wise. Not that it matters.

Link to the PR in django-csp that makes this change: mozilla/django-csp#270

Link to the changelog in django-csp: https://github.com/mozilla/django-csp/blob/main/CHANGES.md#breaking-changes

As of version 4.0 of django-csp, the behavior of the
object that wraps the nonce in the request and/or context
has changed.  Testing for truthiness now returns `False`
instead of `True`.

The truthiness check is unnecessary anyway, skipping it
is compatible with all versions of django-csp.  Probably
more performant too, template rendering wise. Not that
it matters.
@maxfenv maxfenv changed the title Don't test nonce for truthiness before inclusion CSP: Don't test nonce for truthiness before inclusion May 20, 2025
@Gagaro
Copy link
Member

Gagaro commented Jun 2, 2025

Thanks 👍 !

@Gagaro Gagaro merged commit 7f3da5c into makinacorpus:master Jun 2, 2025
17 checks passed
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