1. ===========================
    
  2. Django 2.1.15 release notes
    
  3. ===========================
    
  4. 
    
  5. *December 2, 2019*
    
  6. 
    
  7. Django 2.1.15 fixes a security issue and a data loss bug in 2.1.14.
    
  8. 
    
  9. CVE-2019-19118: Privilege escalation in the Django admin.
    
  10. =========================================================
    
  11. 
    
  12. Since Django 2.1, a Django model admin displaying a parent model with related
    
  13. model inlines, where the user has view-only permissions to a parent model but
    
  14. edit permissions to the inline model, would display a read-only view of the
    
  15. parent model but editable forms for the inline.
    
  16. 
    
  17. Submitting these forms would not allow direct edits to the parent model, but
    
  18. would trigger the parent model's ``save()`` method, and cause pre and post-save
    
  19. signal handlers to be invoked. This is a privilege escalation as a user who
    
  20. lacks permission to edit a model should not be able to trigger its save-related
    
  21. signals.
    
  22. 
    
  23. To resolve this issue, the permission handling code of the Django admin
    
  24. interface has been changed. Now, if a user has only the "view" permission for a
    
  25. parent model, the entire displayed form will not be editable, even if the user
    
  26. has permission to edit models included in inlines.
    
  27. 
    
  28. This is a backwards-incompatible change, and the Django security team is aware
    
  29. that some users of Django were depending on the ability to allow editing of
    
  30. inlines in the admin form of an otherwise view-only parent model.
    
  31. 
    
  32. Given the complexity of the Django admin, and in-particular the permissions
    
  33. related checks, it is the view of the Django security team that this change was
    
  34. necessary: that it is not currently feasible to maintain the existing behavior
    
  35. while escaping the potential privilege escalation in a way that would avoid a
    
  36. recurrence of similar issues in the future, and that would be compatible with
    
  37. Django's *safe by default* philosophy.
    
  38. 
    
  39. For the time being, developers whose applications are affected by this change
    
  40. should replace the use of inlines in read-only parents with custom forms and
    
  41. views that explicitly implement the desired functionality. In the longer term,
    
  42. adding a documented, supported, and properly-tested mechanism for
    
  43. partially-editable multi-model forms to the admin interface may occur in Django
    
  44. itself.
    
  45. 
    
  46. Bugfixes
    
  47. ========
    
  48. 
    
  49. * Fixed a data loss possibility in the
    
  50.   :meth:`~django.db.models.query.QuerySet.select_for_update()`. When using
    
  51.   ``'self'`` in the ``of`` argument with :ref:`multi-table inheritance
    
  52.   <multi-table-inheritance>`, a parent model was locked instead of the
    
  53.   queryset's model (:ticket:`30953`).