[Django] #32604: File uploads larger than FILE_UPLOAD_MAX_MEMORY_SIZE get wrong unix group based on setgid

3 views
Skip to first unread message

Django

unread,
Mar 29, 2021, 4:27:35 PM3/29/21
to django-...@googlegroups.com
#32604: File uploads larger than FILE_UPLOAD_MAX_MEMORY_SIZE get wrong unix group
based on setgid
-----------------------------------------+------------------------
Reporter: Gavin Wahl | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 3.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
My MEDIA_ROOT directory has setgid set to force the group of newly created
files. For file uploads less than FILE_UPLOAD_MAX_MEMORY_SIZE, django
creates a file inside MEDIA_ROOT and the group is set as expected. For
larger files, django creates a temporary file in another directory, then
moves it to MEDIA_ROOT. Since the file was created in a temporary
directory, it doesn't get the correct group. I expect uploaded media files
to get the group from MEDIA_ROOT, despite whatever magic django internals
are doing.

This can not be fixed with FILE_UPLOAD_PERMISSIONS, because that only sets
permissions, not the group of the file.

The permissions form of this bug is referenced here: https://github.com
/django-cms/django-filer/issues/1031

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

Django

unread,
Mar 30, 2021, 3:17:38 AM3/30/21
to django-...@googlegroups.com
#32604: File uploads larger than FILE_UPLOAD_MAX_MEMORY_SIZE get wrong unix group
based on setgid
--------------------------------------+------------------------------------

Reporter: Gavin Wahl | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: File uploads/storage | Version: 3.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Carlton Gibson):

* type: Uncategorized => Cleanup/optimization
* component: Uncategorized => File uploads/storage
* stage: Unreviewed => Accepted


Comment:

OK, yes, this is related to #27334 (also #28540) - if we can make a
similar adjustment for the group it should be acceptable.

--
Ticket URL: <https://code.djangoproject.com/ticket/32604#comment:1>

Django

unread,
Feb 10, 2022, 3:51:44 AM2/10/22
to django-...@googlegroups.com
#32604: File uploads larger than FILE_UPLOAD_MAX_MEMORY_SIZE get wrong unix group
based on setgid
-------------------------------------+-------------------------------------
Reporter: Gavin Wahl | Owner: Mohamed
Type: | El-Kalioby
Cleanup/optimization | Status: assigned
Component: File | Version: 3.1
uploads/storage |

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mohamed El-Kalioby):

* owner: nobody => Mohamed El-Kalioby
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/32604#comment:2>

Django

unread,
Feb 10, 2022, 3:52:47 AM2/10/22
to django-...@googlegroups.com
#32604: File uploads larger than FILE_UPLOAD_MAX_MEMORY_SIZE get wrong unix group
based on setgid
--------------------------------------+------------------------------------
Reporter: Gavin Wahl | Owner: (none)

Type: Cleanup/optimization | Status: new
Component: File uploads/storage | Version: 3.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Mohamed El-Kalioby):

* owner: Mohamed El-Kalioby => (none)
* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/32604#comment:3>

Django

unread,
Mar 9, 2022, 5:16:17 PM3/9/22
to django-...@googlegroups.com
#32604: File uploads larger than FILE_UPLOAD_MAX_MEMORY_SIZE get wrong unix group
based on setgid
-------------------------------------+-------------------------------------
Reporter: Gavin Wahl | Owner: Mateo
Type: | Radman

Cleanup/optimization | Status: assigned
Component: File | Version: 3.1
uploads/storage |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mateo Radman):

* owner: nobody => Mateo Radman


* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/32604#comment:2>

Django

unread,
Mar 12, 2022, 8:12:30 AM3/12/22
to django-...@googlegroups.com
#32604: File uploads larger than FILE_UPLOAD_MAX_MEMORY_SIZE get wrong unix group
based on setgid
-------------------------------------+-------------------------------------
Reporter: Gavin Wahl | Owner: Mateo
Type: | Radman
Cleanup/optimization | Status: assigned
Component: File | Version: 3.1
uploads/storage |
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
-------------------------------------+-------------------------------------
Changes (by Mateo Radman):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/15505 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/32604#comment:3>

Django

unread,
Mar 29, 2022, 1:06:02 AM3/29/22
to django-...@googlegroups.com
#32604: File uploads larger than FILE_UPLOAD_MAX_MEMORY_SIZE get wrong unix group
based on setgid
-------------------------------------+-------------------------------------
Reporter: Gavin Wahl | Owner: Mateo
Type: | Radman
Cleanup/optimization | Status: assigned
Component: File | Version: 3.1
uploads/storage |
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
-------------------------------------+-------------------------------------

Comment (by Mateo Radman):

Hi,
Is there anything else that needs to be done here?
Thanks!

--
Ticket URL: <https://code.djangoproject.com/ticket/32604#comment:4>

Django

unread,
Apr 7, 2022, 6:03:54 AM4/7/22
to django-...@googlegroups.com
#32604: File uploads larger than FILE_UPLOAD_MAX_MEMORY_SIZE get wrong unix group
based on setgid
-------------------------------------+-------------------------------------
Reporter: Gavin Wahl | Owner: Mateo
Type: | Radman
Cleanup/optimization | Status: assigned
Component: File | Version: 3.1
uploads/storage |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/32604#comment:5>

Django

unread,
Apr 7, 2022, 8:28:18 AM4/7/22
to django-...@googlegroups.com
#32604: File uploads larger than FILE_UPLOAD_MAX_MEMORY_SIZE get wrong unix group
based on setgid
-------------------------------------+-------------------------------------
Reporter: Gavin Wahl | Owner: Mateo
Type: | Radman
Cleanup/optimization | Status: assigned
Component: File | Version: 3.1
uploads/storage |
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
-------------------------------------+-------------------------------------
Changes (by Mateo Radman):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/32604#comment:6>

Django

unread,
Apr 11, 2022, 7:33:12 AM4/11/22
to django-...@googlegroups.com
#32604: File uploads larger than FILE_UPLOAD_MAX_MEMORY_SIZE get wrong unix group
based on setgid
-------------------------------------+-------------------------------------
Reporter: Gavin Wahl | Owner: Mateo
Type: | Radman
Cleanup/optimization | Status: assigned
Component: File | Version: 3.1
uploads/storage |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/32604#comment:7>

Django

unread,
Apr 12, 2022, 12:07:56 AM4/12/22
to django-...@googlegroups.com
#32604: File uploads larger than FILE_UPLOAD_MAX_MEMORY_SIZE get wrong unix group
based on setgid
-------------------------------------+-------------------------------------
Reporter: Gavin Wahl | Owner: Mateo
Type: | Radman
Cleanup/optimization | Status: closed

Component: File | Version: 3.1
uploads/storage |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"884b4c27f506b3c29d58509fc83a35c30ea10d94" 884b4c2]:
{{{
#!CommitTicketReference repository=""
revision="884b4c27f506b3c29d58509fc83a35c30ea10d94"
Fixed #32604 -- Made file upload respect group id when uploading to a
temporary file.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/32604#comment:8>

Reply all
Reply to author
Forward
0 new messages