Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restricted file downloads #592

Open
pozylon opened this issue Apr 24, 2024 · 1 comment
Open

Restricted file downloads #592

pozylon opened this issue Apr 24, 2024 · 1 comment
Assignees
Labels
feature request Suggest an idea for this project

Comments

@pozylon
Copy link
Member

pozylon commented Apr 24, 2024

Currently unchained does not restrict access to a file, so once you get the URL of a media uploaded, that stays permanent and is only restricted by webserver rules.

I suggest extending this:

  • When creating media upload tickets, allow to set it as a "private" file, signaling the file plugin to generate temporary download url's and not persistent ones
  • Add "action.downloadFile" and wire it with the Media.url field resolver. By default it just checks for the file to be public and returns true, else it checks if the file has been uploaded by logged in user.
  • Extend Media.url field resolver to generate a signed url through the file plugin when a file is "private"
  • When accessing the url of a "Media" and the file is "private", generate a signature guarded url that expires based on fileSettings.privateFileSharingMaxAge o.e.
  • Extend gridfs webhook to check if the file is public or if the provided signature works and the shared url is not expired.

The end goal is that one can overwrite the permission "action.downloadFile" and make it dependent on context: It can be extended for any use case, for ex. completely lock it down and reject download access even for the uploader for form submission files for example.

@pozylon pozylon added the feature request Suggest an idea for this project label Apr 24, 2024
@pozylon
Copy link
Member Author

pozylon commented May 8, 2024

@Mikearaya can you check this concept and tell me what you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Suggest an idea for this project
Projects
None yet
Development

No branches or pull requests

2 participants