Use AI to enable and generate RLS policies for Postgres with Supabase

Поделиться
HTML-код
  • Опубликовано: 8 сен 2024

Комментарии • 55

  • @Supabase
    @Supabase  9 месяцев назад +12

    This is just the first announcement of Supabase Launch Week X.
    Read the blog post here: supabase.com/blog/studio-introducing-assistant?

    • @Supabase
      @Supabase  9 месяцев назад +2

      And more Launch week announcements here: supabase.com/launch-week?

    • @awalias
      @awalias 8 месяцев назад

      @@Supabase spicy

    • @codooze
      @codooze 8 месяцев назад

      I didn't know we could also impersonate users from Supabase, that's a huge help. Also pls a video about creating customs roles, and how they relate to auth.users if there is any relation, because I don't know if we should be modifying that.

    • @DarrylChangHeathcote
      @DarrylChangHeathcote 3 месяца назад +1

      my UI does not match the UI in this video. Not sure if this version of Supabase is outdated?

  • @adamordway4548
    @adamordway4548 9 месяцев назад +28

    This is great! I really like the impersonation feature. It’s always a pain to test different levels of access.

    • @JonMeyers
      @JonMeyers 9 месяцев назад +5

      Yeah, I agree! This is going to save me so much time! 🎉

    • @awalias
      @awalias 8 месяцев назад

      @@JonMeyers the kinda thing you don't realize how much it was missing until it's there!

  • @dshukertjr
    @dshukertjr 8 месяцев назад +8

    I was just playing around with user impersonation, and wow it's easy to use and powerful.

    • @awalias
      @awalias 8 месяцев назад

      Yeah I honestly love this feature!

  • @Flopshoubox
    @Flopshoubox 9 месяцев назад +12

    Those impersonate tool and ai assitant are damn good ! Makes me want to deep dive on RLS !

    • @JonMeyers
      @JonMeyers 9 месяцев назад +2

      Yeah, it’s going to save me so much time! 🚀

  • @yarapolana
    @yarapolana 9 месяцев назад +10

    OMGGGGG I literally suggested this on Twitter/X, I had no clue you were actually implementing it.

  • @BretMogilefsky
    @BretMogilefsky 8 месяцев назад +8

    Terrific stuff, very well presented. Thanks!

  • @thorwebdev
    @thorwebdev 8 месяцев назад +3

    This is awesome, the Supabase Dashboard is becoming so incredibly powerful 🙌

  • @dnlmgwi
    @dnlmgwi 9 месяцев назад +8

    Love This!

    • @JonMeyers
      @JonMeyers 9 месяцев назад +2

      Glad you enjoyed it! 🙌 Much more coming over the next few days!

  • @darkbacon2630
    @darkbacon2630 9 месяцев назад +8

    awesome feature 🤙

    • @JonMeyers
      @JonMeyers 9 месяцев назад +1

      It’s one of my favourites so far! 🚀

  • @ricardocnn
    @ricardocnn 9 месяцев назад +8

    Awesome video!

    • @JonMeyers
      @JonMeyers 9 месяцев назад +1

      Thanks! 🙌 Glad you enjoyed it! What do you want to see next?

    • @ricardocnn
      @ricardocnn 9 месяцев назад

      @@JonMeyers RLS also set a limit of registers?

  • @emergingbits
    @emergingbits 9 месяцев назад +7

    This is great. Thanks for the hard work! I also find defining functions a bit jarring as a new user. For instance to inserting multiple records relational queries is a common use case that's not that easy to do out of the box. An AI tool for functions and some advanced examples with `plpgsql` or how to properly use sql in functions would be greatly appreciated. Or an alternative would be to provide the supabase sdk to allow for nested inserts (for relational queries) would be a huge unlock (like it's possible with Prisma if you google: Prisma Relational Queries: Nested Writes)

    • @JonMeyers
      @JonMeyers 9 месяцев назад +2

      Great feedback! 🙌 Supabase AI is also available in the SQL Editor so it can help you write your Postgres functions. I am also putting together a bunch of Postgres theory content for next year so will make sure all of this is covered!

  • @eleah2665
    @eleah2665 9 месяцев назад +4

    Jon is here!

    • @JonMeyers
      @JonMeyers 9 месяцев назад +2

      Let’s get into it!

  • @frnk_snslvdr
    @frnk_snslvdr 8 месяцев назад +2

    User Impersonation: brilliant

  • @davebenjamin4388
    @davebenjamin4388 9 месяцев назад +4

    Awesome but when will it be available for local Dev, which is where we really need this?

  • @farow610
    @farow610 9 месяцев назад +2

    The impersonation feature only works with supabase auth and not next-auth, correct ? Also, the ai assistant is so cool but does it have hallucinations like Chatgpt ?

    • @JonMeyers
      @JonMeyers 9 месяцев назад

      I haven't played with next-auth for a while, but if it doesn't enforce regular RLS policies, then the impersonation feature won't match what a user in next-auth would get back. Also, I don't think next-auth uses the auth.users table so your next-auth users will probably not show up under the impersonation tab - again, haven't tested this so it might work perfectly! 🙂
      We recommend checking the AI suggestion is what you want to do before running the SQL, as it may get a little "creative" 👍

  • @jimvh7557
    @jimvh7557 Месяц назад +1

    Apparently: Supabase introduced a feature that used AI to generate Row Level Security (RLS) policies at the beginning of 2024. However, this feature is no longer available. The removal may be related to several challenges and limitations associated with RLS policies and their implementation.
    RLS policies in Supabase can become complex and challenging to manage, especially when dealing with performance issues and maintaining consistency across different parts of the application. There have been reports of difficulties in testing and debugging these policies, as well as issues with maintaining a good developer experience  .
    Additionally, there are specific technical hurdles related to RLS, such as the need for duplicating policy filters in application code and ensuring that policies are correctly applied without impacting performance .
    Given these complexities, it’s possible that Supabase decided to remove the AI-generated RLS policy feature to focus on more stable and manageable solutions. For current best practices on implementing RLS in Supabase, you can refer to their official documentation.

    • @sokrates297
      @sokrates297 13 дней назад

      I've been struggling so hard just to implement a simple insert, select, update, and delete. It's crazy there's no default RLS with just applied "authenticated" using "true", and it working out of the box. I've never seen such "secure"/tied down system to a sql database before.

  • @coleblender
    @coleblender 2 месяца назад

    I use DrizzleORM and connect to my DB with a connection string. I have enabled RLS and haven't created a policy but I'm still able to query the data on my website. Why is this?

  • @gustavomonteiro2008
    @gustavomonteiro2008 12 дней назад

    My question IS : How to insert a Record that has is_published set to false? Never understood why The selected policy always run after an update. It reduces so much the Power of this approach

  • @2an_sound
    @2an_sound 8 месяцев назад +1

    Why is your UI for creating a new policy so different from mine? When I click New Policy it brings up the modal with templates or from scratch options.

    • @chychywoohoo
      @chychywoohoo 7 месяцев назад +1

      Same for me. This video seems to be outdated

  • @andreasfun9591
    @andreasfun9591 3 месяца назад

    Hi there! Thanks for the vid. I am having trouble using Supabase with Buildship. Even when I enable RLS, use a policy I get null. I disable RLS, I still get null. These happen both for using anon key and the service role secret key.. Do you have any idea why this is happening and how to fix it?

  • @1gouravgg
    @1gouravgg 9 месяцев назад +1

    is there really a need to enable RLS if I access db only via backend?

    • @pearceodegard582
      @pearceodegard582 8 месяцев назад

      What if someone attempts to access your database API directly if they get ahold of the URL?

    • @thorwebdev
      @thorwebdev 8 месяцев назад +1

      If you don’t expose your anon key it’s fine. But better be safe than sorry!

  • @mahdiboughanmi6781
    @mahdiboughanmi6781 4 месяца назад

    am new to supabase and postgres , while i loved it at first i hated rls for more complicated schemas
    like for exp user owns a store and a store has its own categories
    how do i write a policy for only store owners can add categories when they don't have direct relationship

  • @onedayapp3534
    @onedayapp3534 2 месяца назад

    I cant see the AI chat on policies

  • @din2
    @din2 9 месяцев назад

    How to make page views with NextJs and Supabase?

  • @supa_olirice
    @supa_olirice 8 месяцев назад

    🚀

  • @schlep
    @schlep 8 месяцев назад

    🤖🚀🚀

  • @ricardocnn
    @ricardocnn 9 месяцев назад

    I don't have this feature.

  • @sonuaryan5287
    @sonuaryan5287 3 месяца назад

    Enabling RLS strict live changes

  • @RajeshNeupane-j3u
    @RajeshNeupane-j3u Месяц назад

    Could you please stop shaking your body. It's distracting from what you're saying!

  • @souravhazari4983
    @souravhazari4983 9 месяцев назад

    Through RLS I have acheive user_permission design. With this I can control which user can select, insert and update or delete from a table's boolean value ,,user wise row.

  • @HijabiCoder
    @HijabiCoder 9 месяцев назад +6

    🔥 🆇

    • @JonMeyers
      @JonMeyers 9 месяцев назад +4

      4 more to go! Plus all those other one more things! 😆

    • @Supabase
      @Supabase  9 месяцев назад +3

      There's always one more thing(s)

  • @rodrigomansuelinunes1285
    @rodrigomansuelinunes1285 8 месяцев назад +2

    Great video!