#25905: Unsafe usage of urljoin() within FileStorageSystem
-------------------------------------+-------------------------------------
Reporter: Aman Ali | Owner: Tobias
Type: | Kunze
Cleanup/optimization | Status: closed
Component: File | Version: 1.9
uploads/storage |
Severity: Normal | Resolution: fixed
Keywords: file, storage | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by bhch):
* cc: bhch (added)
Comment:
The
[https://github.com/django/django/commit/fdf5cd3429369954e8deb764d9f30f6374581613
#diff-87c0869f58253f571c08ccf0fc5c7465R410 current fix] strips off all the
leading slashes thereby making it a relative path, to which `urljoin`
later prepends a base url. This removes the possibility of serving a
default file from the static url.
I think a better solution would be to remove more than 1 leading slashes,
but not one.
Current implementation: `url.lstrip('/')`.
Proposed: `re.sub(r'/{2,}', '/', url)`.
This will allow us to serve a default file from static url.
--
Ticket URL: <https://code.djangoproject.com/ticket/25905#comment:7>
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 on the web visit
https://groups.google.com/d/msgid/django-updates/069.717ca33680157371c9949cf495119728%40djangoproject.com.