-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
FR: ACL for Parse.File #7001
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
Comments
Some comments:
|
The most recent discussion has been in
Shouldn't this be a feature of retrieving a file rather than saving a file?
Instead of the current approach, how about introducing a new Parse Server configuration option where one can specify which files, when retrieved, come with a temporary URL. The specification should be in RegEx for flexibility. Example:
The master key should still retrieve the permanent URL, so that a developer can retrieve
|
Thank you for the suggestions.
The OTP secret used to generate the token is saved on create of a file. The OTP secret is a long, private string used to create and verify TOTP codes. That secret is then used on find of a file in a object to create a token in the URL, which is validated when retrieving the file. The secret is never exposed to the client, and is always the same for one ParseFile, but different for each one.
Ideally, file.setACL, and then file.save. But is there an updateHandler for file.save, or only createHandler?
I like the idea, however I don’t think there would be any way to tell during a GET FILE request the difference between the classes that the file is reference to. Unless we add ‘parent=class’ to the URL but that could be easily changed by the user.
Yeah, good call. Can easily add that to the GET endpoint. |
Correct, with my approach the ACL can be changed in an existing fileTrigger as well.
Ok, so move the functionality to the adapters, but ignore S3? |
We can also implement for s3 adapter. direct access set false, it would basically same thing of the others, for direct access set true we can use aws service for generating the tempo urls. |
@mtrezza my mistake, it would be easy to interpret which class the file came from during the expandFilesInObject function. Building it this way would need:
Limitations: -If any temporary files are used, every file get request will have to check for a token, even those with a masterKey, as it's impossible to know which GET requests are performed with a masterKey and which ones aren't. Have I interpreted your proposal correctly? |
Currently, to access a file, you only need the URL. Once someone has the file URL, it's there's forever. Although the file names are long random strings, some deeper security might be required for certain files.
I'm working on a PR that could hopefully help manage Parse.Files a bit better, which could work towards keeping track of file reference counts and "cleaning up" files with no references. I've also worked on some other features:
This PR, creates a "_File" object on the save of a file, which generates an OTP secret. The OTP secret is then used to create a token when a Parse.Object with a Parse.File is requested (providing the auth is valid for the "_File" acl).
The file url will now have a token attached to it, which expires in 5 min, meaning that the GET request can be performed, but the URL won't be able to pull the file later (unless ACL is set to public read).
I added 'references' to the '_File' object, and I was thinking when a Parse.Object is saved referencing a file, increment 'references', and when it changes or removes the file, decrement 'references'. Then, if 'references' == 0, delete the file.
I've currently passed the ACL through setTags (for proof of concept) as there's no setACL on Parse.File yet.
I'm also not sure how running .save on an existing file would affect this (E.g changing data or changing ACLs. Maybe I should query "_File" first?).
I've started working on a draft PR as to how I imagine this feature being implemented. Any thoughts or suggestions are valued.
This is in relation to #6572, #5080, #1023, #6780 and this discussion in the community forum.
The text was updated successfully, but these errors were encountered: