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