Segmenting cache by current user or tenant #752
Unanswered
rolftimmermans
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
An issue was flagged internally because in our application a user might theoretically have access to files from another user if they can figure out the cache's file id. Although this is not trivial in itself (and may require other vulnerabilities to be exploitable), it is also not theoretically impossible because the file id is sent to the application frontend after uploading to the cache.
Based on the principle of defence in depth, we would prefer to segment the cache by current user. Each model that has the possibility to have a Shrine file attached to it, has a
user_idcolumn. How can we instruct Shrine to read files to/fromcache/#{user_id}/#{file_id}?Presumably it is possible to make
user_idpart of the generated location. But this sort of defeats the point, because then the user-supplied cache location contains theuser_id, which would then have to be validated before accepting it. Ideally theuser_idpart is only used internally by Shrine and not stored or transmitted anywhere. What is the recommended approach here? Has anyone else treated this as a security issue?All reactions