Menu

Django's Built-In CSP: What 6.0 Shipped and 6.1 Fixed
πŸ“°

Django's Built-In CSP: What 6.0 Shipped and 6.1 Fixed

DEV Community: djangoΒ·Papan SarkarΒ·2 days ago
#M9YpQtSv
#devtodjango#devto#dev#filters#django
Reading 0:00
15s threshold

The admin login page came up with no styling and no JavaScript. The console was a wall of Refused to load the script errors, every one of them pointing at something under /static/admin/js/ . An hour earlier I had added nine lines to settings.py on a Django 6.0 project to turn on a nonce-based Content Security Policy. The policy was fine. The admin templates were the problem, and that turned out to be a known bug rather than my mistake.

If you are adopting the CSP support Django now ships in core, that is the shape of the first afternoon. The settings are genuinely simple. The surprises are all in what a strict policy does to code you did not write β€” the admin, your form widgets, your cache layer.

What 6.0 actually moved into core

Before 6.0 this was third-party territory.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.