# "New row violates row-level security policy" on Supabase Storage

> Supabase Storage refuses every upload without an RLS policy on storage.objects by default. The exact INSERT/SELECT policies needed, and why the error says "row" when you're uploading a file, not inserting a database row.

Source: https://scribase.com/supabase-storage-rls-403

The confusing part is the wording: you called an upload function, but the error talks about a "row" because Storage objects are rows in a real Postgres table, storage.objects, and that table has row level security enabled the same as any table you create yourself.

## Why this happens

Supabase states the default outright: "By default Storage does not allow any uploads to buckets without RLS policies." Every file lives as a row in storage.objects, and that table has row level security on by default — no policy means no permission, for every operation, until you write one.

## Sources

- [Supabase: Storage access control](https://supabase.com/docs/guides/storage/security/access-control)

## The policies you actually need

- To upload at all: Supabase's docs state "the only RLS policy required for uploading objects is to grant the INSERT permission to the storage.objects table" — nothing more, for a basic upload.
- To read a file back: a SELECT policy is required separately; Supabase's example scopes it so a user can "access a file that was previously uploaded by the same user" by matching the signed-in user's auth.uid() to the object's owner field.
- To overwrite an existing file with upsert: SELECT and UPDATE permissions are both needed in addition to INSERT, per Supabase's docs.

_A minimal upload + read policy pair, scoped to one bucket_

```sql
create policy "Users can upload their own files"
on storage.objects for insert to authenticated
with check (bucket_id = 'avatars' and owner = auth.uid());

create policy "Users can read their own files"
on storage.objects for select to authenticated
using (bucket_id = 'avatars' and owner = auth.uid());
```

## Sources

- [Supabase: Storage access control](https://supabase.com/docs/guides/storage/security/access-control)

## The same model on Scribase

Scribase Storage is RLS-protected the same way: file uploads go through policies on the storage objects table, written the same policy language as any other table, so the fix above (an explicit INSERT policy, a separate SELECT policy to read files back) is the same discipline, not a different one to relearn.

scribase-migrate's Supabase source moves storage buckets and objects in the same run as the schema and auth.users, so existing files and their ownership carry over rather than needing their policies rewritten from scratch.

_scribase-migrate, Supabase source_

```sh
npx --yes git+https://rithub.dev/caelum0x/scribase-migrate.git supabase \
  --to <org>/<project> --create-project \
  --source-ref <project-ref> \
  --source-url "postgres://postgres:<password>@db.<project-ref>.supabase.co:5432/postgres" \
  --source-service-key "<service_role key>" \
  --verify-login-email you@example.com
```

## Sources

- [Scribase pricing](https://scribase.com/pricing)

## FAQ

**Why does the error say "row" when I was uploading a file?**

Because Supabase Storage stores every file as a row in the real Postgres table storage.objects, and that table has row level security on by default — the error is literal, not a mistranslation.

**What is the single policy that unblocks an upload?**

An INSERT policy on storage.objects — Supabase's own docs state that is the only policy strictly required for uploading objects.

**Do I need a separate policy to display an uploaded file?**

Yes — reading a file back requires its own SELECT policy on storage.objects; an INSERT-only policy lets files in but not back out.

**Can I just make the bucket public instead of writing policies?**

Marking a bucket public changes how unauthenticated reads are served, but it does not replace the INSERT policy requirement for authenticated uploads — RLS on storage.objects still applies to write operations.

## Related

- [Supabase storage limit](https://scribase.com/supabase-storage-limit)
- [Supabase RLS policy examples](https://scribase.com/supabase-rls-policy-examples)
- [Supabase alternative](https://scribase.com/supabase-alternative)
- [Migrate from Supabase](https://scribase.com/migrate/supabase)