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

Sdílet
Vložit
  • čas přidán 5. 09. 2024

Komentáře • 55

  • @Supabase
    @Supabase  Před 8 měsíci +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  Před 8 měsíci +2

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

    • @awalias
      @awalias Před 8 měsíci

      @@Supabase spicy

    • @codooze
      @codooze Před 8 měsíci

      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 Před 3 měsíci +1

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

  • @adamordway4548
    @adamordway4548 Před 8 měsíci +28

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

    • @JonMeyers
      @JonMeyers Před 8 měsíci +5

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

    • @awalias
      @awalias Před 8 měsíci

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

  • @Flopshoubox
    @Flopshoubox Před 8 měsíci +12

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

    • @JonMeyers
      @JonMeyers Před 8 měsíci +2

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

  • @dshukertjr
    @dshukertjr Před 8 měsíci +8

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

    • @awalias
      @awalias Před 8 měsíci

      Yeah I honestly love this feature!

  • @yarapolana
    @yarapolana Před 8 měsíci +10

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

  • @eleah2665
    @eleah2665 Před 8 měsíci +4

    Jon is here!

    • @JonMeyers
      @JonMeyers Před 8 měsíci +2

      Let’s get into it!

  • @BretMogilefsky
    @BretMogilefsky Před 8 měsíci +8

    Terrific stuff, very well presented. Thanks!

  • @darkbacon2630
    @darkbacon2630 Před 8 měsíci +8

    awesome feature 🤙

    • @JonMeyers
      @JonMeyers Před 8 měsíci +1

      It’s one of my favourites so far! 🚀

  • @thorwebdev
    @thorwebdev Před 8 měsíci +3

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

  • @ricardocnn
    @ricardocnn Před 8 měsíci +8

    Awesome video!

    • @JonMeyers
      @JonMeyers Před 8 měsíci +1

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

    • @ricardocnn
      @ricardocnn Před 8 měsíci

      @@JonMeyers RLS also set a limit of registers?

  • @emergingbits
    @emergingbits Před 8 měsíci +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 Před 8 měsíci +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!

  • @dnlmgwi
    @dnlmgwi Před 8 měsíci +8

    Love This!

    • @JonMeyers
      @JonMeyers Před 8 měsíci +2

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

  • @davebenjamin4388
    @davebenjamin4388 Před 8 měsíci +4

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

  • @frnk_snslvdr
    @frnk_snslvdr Před 8 měsíci +2

    User Impersonation: brilliant

  • @farow610
    @farow610 Před 8 měsíci +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 Před 8 měsíci

      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" 👍

  • @coleblender
    @coleblender Před 2 měsíci

    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?

  • @jimvh7557
    @jimvh7557 Před 29 dny +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 Před 10 dny

      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.

  • @2an_sound
    @2an_sound Před 8 měsíci +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 Před 7 měsíci +1

      Same for me. This video seems to be outdated

  • @gustavomonteiro2008
    @gustavomonteiro2008 Před 9 dny

    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

  • @andreasfun9591
    @andreasfun9591 Před 3 měsíci

    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 Před 8 měsíci +1

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

    • @pearceodegard582
      @pearceodegard582 Před 8 měsíci

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

    • @thorwebdev
      @thorwebdev Před 8 měsíci +1

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

  • @mahdiboughanmi6781
    @mahdiboughanmi6781 Před 4 měsíci

    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 Před 2 měsíci

    I cant see the AI chat on policies

  • @din2
    @din2 Před 8 měsíci

    How to make page views with NextJs and Supabase?

  • @ricardocnn
    @ricardocnn Před 8 měsíci

    I don't have this feature.

  • @schlep
    @schlep Před 8 měsíci

    🤖🚀🚀

  • @supa_olirice
    @supa_olirice Před 8 měsíci

    🚀

  • @sonuaryan5287
    @sonuaryan5287 Před 3 měsíci

    Enabling RLS strict live changes

  • @RajeshNeupane-j3u
    @RajeshNeupane-j3u Před 28 dny

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

  • @souravhazari4983
    @souravhazari4983 Před 8 měsíci

    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 Před 8 měsíci +6

    🔥 🆇

    • @JonMeyers
      @JonMeyers Před 8 měsíci +4

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

    • @Supabase
      @Supabase  Před 8 měsíci +3

      There's always one more thing(s)

  • @rodrigomansuelinunes1285
    @rodrigomansuelinunes1285 Před 8 měsíci +2

    Great video!