Skip to content

Remove CSPMiddlewareAlwaysGenerateNonce #274

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

Merged
merged 1 commit into from
Mar 18, 2025
Merged

Conversation

robhudson
Copy link
Contributor

The middleware was originally added to support Django Debug Toolbar by forcing nonce headers even when not used in content. This is no longer needed since Debug Toolbar now handles this properly with CheckableLazyObject.

It is recommended to only include a nonce in the header if it is used in the content and as such this removal helps the user follow good security practices.

Copy link
Contributor

@stevejalim stevejalim left a comment

Choose a reason for hiding this comment

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

Makes sense - nice cleanup! r+

@jwhitlock jwhitlock merged commit 395d928 into main Mar 18, 2025
8 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.

3 participants