PricingBlog

Supabase RLS with Buildship

  • building_stuff-1252367361533542410

    Janis

    1 year ago

    Hi all,

    I have a workflow in Buildship that is based on a Supabase trigger when a new row is added. Afterwards, two more nodes with scraping and ChatGPT are executed. It all works fine until I turn on RLS.

    Since I don’t send the bearer token to Buildship, I was now wondering whether it is safe to store the Service Role Key as a secret in Buildship and create a service role policy in Supabase to allow insert action. Does that make sense? 🤔 Thank you soo much 🙏
  • lucasg-1252372992223350864

    Lucas G

    1 year ago

    Service key bypasses RLS, that's why we need to be careful when using it
  • You should still be sending additional info to Buildship to help validate the request
  • Otherwise, anyone who gets the webhook can trigger it
    🙏1
  • building_stuff-1252523433712025693

    Janis

    1 year ago

    Ok yes that makes sense! How do you pass the bearer token though from toddle to Buildship? If I use the Supabase trigger I don’t have option to pass the bearer token so I thought of doing a rest api in Buildship and do a post request from toddle. I configured it and it works but I still don’t know how to send the user‘s bearer token for authorization
  • Thanks a lot for your help @Lucas G
  • lucasg-1252648079015018506

    Lucas G

    1 year ago

    You can’t access the token in the cookie so you’d have to use an API call.
  • lucasg-1252648395361878228

    Lucas G

    1 year ago

    An alternative could maybe be to pass along account info/ID
  • building_stuff-1253039531490279498

    Janis

    1 year ago

    Ok I see
  • I'll play around a bit more and hopefully I´ll figure it out 🙏 Thanks again!