Skip to content

Commit

Permalink
docs(supabase): add warning section for RLS (#229)
Browse files Browse the repository at this point in the history
* docs(supabase): add warning section for RLS

* docs(supabase): add warning reasons about RLS

* docs(supabase): add link to RLS

Co-authored-by: Thor 雷神 Schaeff <[email protected]>

---------

Co-authored-by: Thor 雷神 Schaeff <[email protected]>
  • Loading branch information
devsheva and thorwebdev authored Sep 13, 2024
1 parent e65c9a0 commit 5eda80d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/supabase/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,11 @@ create trigger handle_updated_at before update on YOUR_TABLE_NAME
create trigger handle_updated_at before update on YOUR_TABLE_NAME
for each row execute procedure moddatetime (updated_at);
```


## Notes (WARNING)

Using the `anon public` key will lead to unexpected behaviour since [RLS (Row Level Security)](https://supabase.com/docs/guides/database/postgres/row-level-security) is enabled by default when creating the table, and will lock writing unless explicit permissions.
When RLS is enabled without configuration, a [default-deny policy](https://www.postgresql.org/docs/current/ddl-rowsecurity.html#DDL-ROWSECURITY:~:text=If%20no%20policy%20exists%20for%20the%20table%2C%20a%20default%2Ddeny%20policy%20is%20used%2C%20meaning%20that%20no%20rows%20are%20visible%20or%20can%20be%20modified) is used.

You can use `service_role` secret, but be aware that this will **bypass** RLS.

0 comments on commit 5eda80d

Please sign in to comment.