{"title":"Django 2.1.15 release notes","version":"dev","locale":"en","docname":"releases/2.1.15","url":"/en/dev/releases/2.1.15/","canonical":"https://djangodocs.dev/en/dev/releases/2.1.15/","summary":"Django 2.1.15 fixes a security issue and a data loss bug in 2.1.14. Since Django 2.1, a Django model admin displaying a parent model with related model…","html":"<h1>Django 2.1.15 release notes<a class=\"heading-anchor\" href=\"#django-2-1-15-release-notes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p><em>December 2, 2019</em></p>\n<p>Django 2.1.15 fixes a security issue and a data loss bug in 2.1.14.</p>\n<section id=\"cve-2019-19118-privilege-escalation-in-the-django-admin\">\n<h2>CVE-2019-19118: Privilege escalation in the Django admin.<a class=\"heading-anchor\" href=\"#cve-2019-19118-privilege-escalation-in-the-django-admin\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Since Django 2.1, a Django model admin displaying a parent model with related\nmodel inlines, where the user has view-only permissions to a parent model but\nedit permissions to the inline model, would display a read-only view of the\nparent model but editable forms for the inline.</p>\n<p>Submitting these forms would not allow direct edits to the parent model, but\nwould trigger the parent model’s <code class=\"docutils literal notranslate\">save()</code> method, and cause pre and post-save\nsignal handlers to be invoked. This is a privilege escalation as a user who\nlacks permission to edit a model should not be able to trigger its save-related\nsignals.</p>\n<p>To resolve this issue, the permission handling code of the Django admin\ninterface has been changed. Now, if a user has only the “view” permission for a\nparent model, the entire displayed form will not be editable, even if the user\nhas permission to edit models included in inlines.</p>\n<p>This is a backwards-incompatible change, and the Django security team is aware\nthat some users of Django were depending on the ability to allow editing of\ninlines in the admin form of an otherwise view-only parent model.</p>\n<p>Given the complexity of the Django admin, and in-particular the permissions\nrelated checks, it is the view of the Django security team that this change was\nnecessary: that it is not currently feasible to maintain the existing behavior\nwhile escaping the potential privilege escalation in a way that would avoid a\nrecurrence of similar issues in the future, and that would be compatible with\nDjango’s <em>safe by default</em> philosophy.</p>\n<p>For the time being, developers whose applications are affected by this change\nshould replace the use of inlines in read-only parents with custom forms and\nviews that explicitly implement the desired functionality. In the longer term,\nadding a documented, supported, and properly-tested mechanism for\npartially-editable multi-model forms to the admin interface may occur in Django\nitself.</p>\n</section>\n<section id=\"bugfixes\">\n<h2>Bugfixes<a class=\"heading-anchor\" href=\"#bugfixes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<ul class=\"simple\">\n<li><p>Fixed a data loss possibility in the\n<a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.select_for_update\" title=\"django.db.models.query.QuerySet.select_for_update\"><code class=\"xref py py-meth docutils literal notranslate\">select_for_update()</code></a>. When using\n<code class=\"docutils literal notranslate\">'self'</code> in the <code class=\"docutils literal notranslate\">of</code> argument with <a class=\"reference internal\" href=\"/en/dev/topics/db/models/#multi-table-inheritance\"><span class=\"std std-ref\">multi-table inheritance</span></a>, a parent model was locked instead of the\nqueryset’s model (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/30953\">#30953</a>).</p></li>\n</ul>\n</section>","rootId":"django-2-1-15-release-notes","toc":[{"title":"CVE-2019-19118: Privilege escalation in the Django admin.","anchor":"cve-2019-19118-privilege-escalation-in-the-django-admin","children":[]},{"title":"Bugfixes","anchor":"bugfixes","children":[]}],"breadcrumbs":[{"docname":"releases/index","title":"Release notes","url":"/en/dev/releases/"}],"prev":{"docname":"releases/2.2","title":"Django 2.2 release notes","url":"/en/dev/releases/2.2/"},"next":{"docname":"releases/2.1.14","title":"Django 2.1.14 release notes","url":"/en/dev/releases/2.1.14/"},"formats":{"html":"/en/dev/releases/2.1.15/","markdown":"/en/dev/releases/2.1.15.md","json":"/en/dev/releases/2.1.15.json"},"source":"https://github.com/django/django/blob/main/docs/releases/2.1.15.txt","official":"https://docs.djangoproject.com/en/dev/releases/2.1.15/","inVersions":["dev","6.1","6.0","5.2","5.1","5.0","4.2","4.1","4.0","3.2","3.1","3.0","2.2","2.1"],"inLocales":["en"]}