CSP nonces in the admin site?

Hello,

when I activate a Content Security Policy with the following directives:

SECURE_CSP = {
    "object-src": [CSP.NONE],
    "base-uri": [CSP.NONE],
    "script-src": [CSP.NONCE, CSP.STRICT_DYNAMIC],
}

the Django admin site breaks, because no nonces are added to the scripts used there.

What is a good way to approach this?

Yep, breaks for me too. Although I also am finding weird recursion errors too, so I think using CSP.NONCE is not recommended for now.

Hello, would you be interested in opening a ticket to report the issue?

I’ve opened a ticket in the Django issue tracker:

1 Like