#36913: Optimise ChoiceField / MultipleChoiceField handling of duplicate
submissions
-------------------------------------+-------------------------------------
     Reporter:  Jake Howard          |                    Owner:  Afenomamy
         Type:                       |                   Status:  assigned
  Cleanup/optimization               |
    Component:  Forms                |                  Version:  6.0
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by Afenomamy:

Old description:

> When a ChoiceField / MultipleChoiceField has 5 possible choices, but the
> form submits 25 values, the `choices` values are compared once per
> submitted value. If the submitted values are duplicates, the validation
> doesn't terminate early, but can still spend a lot of time unnecessarily
> validating values. This can be very slow when large (~30k) numbers of
> values are submitted.
>
> A suggested fix is to only validate the unique submitted values (for
> example `for val in set(value)`).
>
> This issue was reported to the Security Team, but deemed not a security
> issue due to the minimal impact when given reasonable input (in the
> bounds of the security policy).

New description:

 When a ChoiceField / MultipleChoiceField has 5 possible choices, but the
 form submits 25 values, the `choices` values are compared once per
 submitted value. If the submitted values are duplicates, the validation
 doesn't terminate early, but can still spend a lot of time unnecessarily
 validating values. This can be very slow when large (~30k) numbers of
 values are submitted.

 A suggested fix is to only validate the unique submitted values (for
 example `for val in set(value)`).

 This issue was reported to the Security Team, but deemed not a security
 issue due to the minimal impact when given reasonable input (in the bounds
 of the security policy).

 sugessted PR : https://github.com/django/django/pull/20960

--
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36913#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019d10a167f1-a0174929-b680-411c-8974-b74e4f6986ee-000000%40eu-central-1.amazonses.com.

Reply via email to