# Signing the CSRF cookie

**URL:** <https://forum.djangoproject.com/t/signing-the-csrf-cookie/35156>\
**Category:** Django Internals\
**Created:** [September 26, 2024, 11:39pm UTC](https://forum.djangoproject.com/t/signing-the-csrf-cookie/35156 "2024-09-26T23:39:07Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![kfan](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kfan/32/27444_2.png) [@kfan](https://forum.djangoproject.com/u/kfan)\
**Post date:** [April 29, 2025, 11:16pm UTC](https://forum.djangoproject.com/t/signing-the-csrf-cookie/35156/7 "2025-04-29T23:16:24Z")

</div>

Bumping this thread to highlight a security need for production sites hosted on shared domains where developers may not control other subdomains. This is common in the public sector, where security is critical. A malicious app on another subdomain could inject or tamper with the CSRF cookie. Without a signature, our site might accept it—potentially allowing unauthorized requests. A signed CSRF cookie mitigates this threat and rejects unauthorized requests made to our site.

This issue is frequently flagged in commercial security audits for multi-subdomain deployments. While it is possible to override Django’s CSRF middleware, doing so can be nontrivial. Adding signed CSRF cookies natively would provide stronger protection and simplify secure deployments.

And there seems to be community interest in improved CSRF handling across subdomains, as noted and posted here in this other discussion: [CSRF protection in subdomains](https://forum.djangoproject.com/t/csrf-protection-in-subdomains/18492)

---

_[View the full topic](https://forum.djangoproject.com/t/signing-the-csrf-cookie/35156)._
