How do I secure files (through the privacy settings) while providing user actions based access to third party services?
I have spent countless hours on figuring this out (trying various AWS upload tools and Wasabi) but it simply seems not fixable…?
What do I need to accomplish
My app uses files. The access to these files should be limited to specific users (which can be managed by uploading ‘private files’ (i.e. setting privacy rules) binding the file to a specific data type and establishing privacy rules to this data type that allow users matching the relevant criteria to view the files). So far so good.
The problem however is that these files have to interact with trusted external services as well (e.g. openAI vector stores, DeepL).
Bubble does not seem to offer a solution for this, or at least I have no been able to figure it out.
Plugins
There are several plugins I have used so far that either interact wit AWS S3 or Wasabi S3. The settings like Access Control Lists (ACL) and CORS (cross origin access) combined with the API are great for shielding the files from users with unauthorized access. The Pre-signed URLs are a great way of getting these files out again [I cannot mention too often that adding this simple feature to bubble’s core functionality would already solve a lot!].
The issues that is not resolved with this, is that users with access to the application could technically access all files, as the access cannot be restricted to a specific user (no privacy rules associated with any of the plugin uploaders) creating major vulnerabilities.
So if you don’t want to use the api_key in the url and instead got the presigned url, i should be possible with a plugin (that can be used in backend WF) that will call the file url with the api_key but avoid to follow redirect and use the location header to get the presigned url.
I don’t know if there’s one that exist and I don’t know if the suggested one by @tylerboodman was doing this. Seem is not available on the marketplace anymore so I cannot inspect code (if this was free)
You can also do it natively by appending an admin API token to the file URL. Whether you want to do that depends on what service you’re calling (and if you trust them)
No the time cannot be changed unfortunately. I think the default is 5 mins but could also be longer when it’s on the CDN. This is arbitrary given the length of the URL ( I.e it won’t be randomly scraped)
unfortunately it’s just a presigned url so we can’t set access if it’s been clicked.