Storage: Private bucket files are still accessible after you remove access or logout #52770
Replies: 2 comments
|
You're not imagining it: after logout or an RLS tighten, a browser can still GET an object it already fetched because the JWT is still valid until expiry and the response may be cached. Practical mitigations:
|
0 replies
|
If you go the signed URL route, two things make it hold up when access changes. Keep the expiry in minutes, not days, and generate the URL at the moment of download, not when you list the files. Signing a whole folder listing for 24 hours means anyone you remove keeps working links for the rest of the day. For immediate revocation you still need the third option, your own endpoint that checks current access on every request before it signs or serves. |
0 replies
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.
A user can sometimes still download a file from a private bucket after you remove their access. This happens after you change an RLS policy or sign the user out. It affects files requested through the authenticated endpoint:
Cause
A cached response skips the Storage service's access check. Two caches can do this:
Fix
A purge doesn't clear browser caches. For files you might need to revoke, set a shorter
cacheControlvalue when you upload them.Prevent
Use signed URLs to serve private files. You control access with an expiry time.
Other options:
All reactions