1
0
mirror of https://github.com/django/django.git synced 2025-10-26 07:06:08 +00:00

[1.5.x] Fixed #23157 -- Removed O(n) algorithm when uploading duplicate file names.

This is a security fix. Disclosure following shortly.
This commit is contained in:
Tim Graham
2014-08-08 10:20:08 -04:00
parent 45ac9d4fb0
commit 26cd48e166
7 changed files with 93 additions and 25 deletions

View File

@@ -81,6 +81,17 @@ The Storage Class
available for new content to be written to on the target storage
system.
.. versionchanged:: 1.5.9
If a file with ``name`` already exists, an underscore plus a random 7
character alphanumeric string is appended to the filename before the
extension.
Previously, an underscore followed by a number (e.g. ``"_1"``, ``"_2"``,
etc.) was appended to the filename until an avaible name in the
destination directory was found. A malicious user could exploit this
deterministic algorithm to create a denial-of-service attack. This
change was also made in Django 1.4.14.
.. method:: get_valid_name(name)