{"slug": "supabase-storage-versioning-is-here-check-your-rls-before-you-turn-it-on", "title": "Supabase Storage versioning is here. Check your RLS before you turn it on", "summary": "Supabase released Object Versioning and Lifecycle Policies for Storage as a public alpha on 1 December 2026, letting buckets retain prior copies on overwrite and add delete markers instead of permanently deleting files. The company's documentation warns that row-level security policies on storage.objects apply to every version, so a user who can read their own folder can also read all its historical versions, and recommends adding 'archived_at is null' to select policies to limit reads to current versions. Versioning is enabled per bucket via updateBucket, and lifecycle rules cap storage growth by expiring noncurrent versions after a set number of days.", "body_md": "On **1 December 2026** Supabase shipped **Object Versioning** and **Lifecycle Policies** for Storage, both as a public alpha. With versioning on, a bucket keeps the previous copy when a file is overwritten and adds a delete marker instead of deleting. Any project can turn it on. Nothing changes for buckets where you don't.\n\nFor a lot of AI-built apps that's good news. Upload code for avatars, logos and generated PDFs often calls `upload(path, file, { upsert: true })`, and until now that overwrote the old file for good. So did a `remove()` from a buggy admin screen. Versioning gives you an undo. It also gives you three things to check first.\n\nYou turn it on per bucket in code. The changelog's example is `supabase.storage.updateBucket('avatars', { public: false, versioningStatus: 'ENABLED' })`. In supabase-js, `updateBucket` requires `public`, so read the current value with `getBucket` and pass it back, or you may flip a bucket's visibility by accident. The statuses are `DISABLED`, `ENABLED` and `SUSPENDED`, and once a bucket leaves `DISABLED` it can't go back.\n\nAfter that, an upload with `upsert: true` to an existing path keeps the earlier copy as a noncurrent version. A delete without a version ID adds a delete marker, so reads return `NoSuchKey`, but the file can be restored. A delete *with* a version ID removes that version permanently. Every version has a `versionId`, and `download`, `info`, `createSignedUrl` and `getPublicUrl` accept one.\n\nRestoring is a `move` with `sourceVersionId` onto the original path. The restored file becomes the current version with a new ID, and the source version is deleted. To undo a delete, you `remove` the delete marker by its version ID. The Dashboard can list, restore and permanently delete versions too.\n\nThis is the part that matters for user data. Supabase's docs say policies on `storage.objects` apply to **every version**. If your select policy says a user can read files in their own folder, they can now read every old version of every file in that folder as well.\n\nUsually that's harmless. It isn't when a user replaces a file *because* they wanted the old one gone: a profile photo, an uploaded ID, a contract with the wrong details. And if your policies are already too loose (say, a policy that lets any signed-in user read the whole bucket), versioning quietly widens the leak to everything that was ever uploaded after you enabled it. If that sounds like your app, our page on [users who can read each other's data](https://rescuemysites.com/fix/users-can-read-each-others-data) is the place to start.\n\nThe docs give the fix: add `archived_at is null` to the `select` policy to limit reads to current versions. The trade-off is that users can then no longer restore a version themselves with `copy` or `move`, so restores go through a server route or the Dashboard. Your `delete` policy governs deletes with and without a version ID, so check that a user who may delete their file may also permanently delete its history, or not.\n\nKept versions count toward Storage usage. An avatar bucket that gets rewritten on every profile save will grow. A lifecycle policy keeps that in check: per bucket, you set `noncurrentDays` (how long a version must be noncurrent before it expires) and optionally `newerNoncurrentVersions` (1 to 100 of the newest to keep regardless of age). Supabase applies rules about once a day, and expired versions are gone for good. Note that `updateBucketLifecycle` replaces the whole policy, so any rule you leave out is removed. Prefix and tag filters aren't supported yet: a rule covers the whole bucket.\n\nA few more things from the docs worth knowing before you rely on this:\n\n`SUSPENDED` bucket, an upload or delete replaces the version written while versioning was off, even if it's noncurrent. Writing to a file that existed before versioning was enabled replaces that original permanently.`emptyBucket` deletes everything, every version and delete marker included, and adds no delete markers. It can't be undone.`NotSupported`. Use supabase-js, the Storage API or the Dashboard for version work.\nBefore you flip `versioningStatus` on a bucket that holds user files, open its `select` policy on `storage.objects` and decide whether users should see old versions. If not, add `archived_at is null` first, then enable versioning, then set a lifecycle rule so the history doesn't grow forever. If you can't tell what your current Storage policies actually allow, that's worth finding out whether or not you turn versioning on.\n\n*First published on [RescueMySites](https://rescuemysites.com/blog/supabase-storage-object-versioning-lifecycle-policies-december-2026).*", "url": "https://wpnews.pro/news/supabase-storage-versioning-is-here-check-your-rls-before-you-turn-it-on", "canonical_source": "https://dev.to/eric_culus/supabase-storage-versioning-is-here-check-your-rls-before-you-turn-it-on-2mfo", "published_at": "2026-12-05 06:33:21+00:00", "updated_at": "2026-12-05 06:44:11.726988+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "ai-infrastructure"], "entities": ["Supabase", "supabase-js"], "also_reported_by": [], "takeaway": "Enabling Supabase Storage versioning makes every historical version readable under existing storage.objects select policies, so add 'archived_at is null' to select policies to restrict reads to current versions, at the cost of users no longer being able to self-restore via copy or move.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/supabase-storage-versioning-is-here-check-your-rls-before-you-turn-it-on", "markdown": "https://wpnews.pro/news/supabase-storage-versioning-is-here-check-your-rls-before-you-turn-it-on.md", "text": "https://wpnews.pro/news/supabase-storage-versioning-is-here-check-your-rls-before-you-turn-it-on.txt", "jsonld": "https://wpnews.pro/news/supabase-storage-versioning-is-here-check-your-rls-before-you-turn-it-on.jsonld"}}