Prevent deep linking to media files #376

Closed
opened 2021-02-14 22:04:43 +01:00 by nik · 11 comments
Owner

Files in /media/ are generally world-readable if their URL is known. We must prevent this, as it might contain sensitive data (like person photos).

There are several options, of which we should chosoe a godo combination:

  • Securing the storage with content hashes/salts/HMAC/etc. in the file and directory names themselves to prevent guessing
  • Tie access to code logic that checks access to the model the file is related to
  • Use django-sendfile to serve media files from a frontend webserver but still retain privilege control inside AlekSIS
Files in `/media/` are generally world-readable if their URL is known. We must prevent this, as it might contain sensitive data (like person photos). There are several options, of which we should chosoe a godo combination: * Securing the storage with content hashes/salts/HMAC/etc. in the file and directory names themselves to prevent guessing * Tie access to code logic that checks access to the model the file is related to * Use django-sendfile to serve media files from a frontend webserver but still retain privilege control inside AlekSIS
Author
Owner

assigned to @debdolph

assigned to @debdolph
Author
Owner

changed the description

changed the description
Author
Owner

mentioned in merge request !2109

mentioned in merge request !2109
Author
Owner

There is a helpful library called django-private-storage. It supports secure file storage with a permission checker, for files linked to a model (by configuring a function that checks permissions before serving the file; we could write a check function that checks permissions on the parent_object that is conveniently passed to this function).

Maybe we can combine this with django-sendfile in some way (and find out whether uwsgi supports sendfile).

There is a helpful library called `django-private-storage`. It supports secure file storage with a permission checker, for files linked to a model (by configuring a function that checks permissions before serving the file; we could write a check function that checks permissions on the `parent_object` that is conveniently passed to this function). Maybe we can combine this with `django-sendfile` in some way (and find out whether `uwsgi` supports sendfile).
lloydmeins commented 2021-05-14 18:11:37 +02:00 (Migrated from edugit.org)

changed the description

changed the description
Owner

mentioned in merge request !2234

mentioned in merge request !2234
Owner

assigned to @nik and unassigned @debdolph

assigned to @nik and unassigned @debdolph
Author
Owner

created merge request !2255 to address this issue

created merge request !2255 to address this issue
Author
Owner

mentioned in merge request !2255

mentioned in merge request !2255
Author
Owner

mentioned in commit 27ea9e895d

mentioned in commit 27ea9e895d56cae7e3066512b75abbe1dc4252b0
Owner

mentioned in commit c6b1d66b45

mentioned in commit c6b1d66b455a308955d769bd10956b8ddb7b4f56
Sign in to join this conversation.
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
aleksis/AlekSIS-Core#376
No description provided.