https://supabase.com/ logo
Join Discord
Powered by
# off-topic
  • j

    jensen

    12/15/2021, 6:40 PM
    once you enable RLS for a table, you need re-enable access to what is allowed using policy.
  • j

    jensen

    12/15/2021, 6:41 PM
    authed users would only be able to select from that table if you add a policy, at least this is how it has worked for me when enabling RLS
  • m

    Mike_

    12/15/2021, 6:41 PM
    ahh, so even with no policies defined, authed users can still select 🤔
  • j

    jensen

    12/15/2021, 6:42 PM
    no I'm saying they can't unless you add a policy
  • m

    Mike_

    12/15/2021, 6:42 PM
    oooh I got you
  • m

    Mike_

    12/15/2021, 6:42 PM
    thanks!
  • j

    jensen

    12/15/2021, 6:42 PM
    So if you want to make selects public but turn everthing else off, you enable RLS and then add a policy to make selects public.
  • j

    jensen

    12/15/2021, 6:43 PM
    as an example
  • j

    jensen

    12/15/2021, 6:44 PM
    I have some examples of procedures and policies for a voting app here https://github.com/jensen/vote-now/blob/main/src/services/schema/tables.sql
  • m

    Mike_

    12/15/2021, 6:45 PM
    awesome, will check out
  • m

    Mike_

    12/15/2021, 6:47 PM
    I wonder if you disagree, but, I've arrived at the conclusion that RLS policies are not flexible /powerful enough for large & serious production apps
  • m

    Mike_

    12/15/2021, 6:48 PM
    and writing to DB from frontend in general
  • j

    jensen

    12/15/2021, 6:48 PM
    I'm still working on my conclusion there.
  • m

    Mike_

    12/15/2021, 6:48 PM
    simple example = needing very advanced validation on what data is being inserted into a row
  • m

    Mike_

    12/15/2021, 6:48 PM
    beyond type checks, etc...
  • j

    jensen

    12/15/2021, 6:49 PM
    Have you worked with PL/pgsql at all?
  • m

    Mike_

    12/15/2021, 6:49 PM
    seems like there's always gonna be some edge case that breaks it
  • m

    Mike_

    12/15/2021, 6:49 PM
    nope 🙂
  • j

    jensen

    12/15/2021, 6:49 PM
    So it seems that for what you are talking about, a lot of this works is pushed into that layer.
  • j

    jensen

    12/15/2021, 6:49 PM
    I can hide complexity behind rpc if I'm willing to write that in SQL (which I am)
  • j

    jensen

    12/15/2021, 6:50 PM
    I'm willing to write SQL, just not sure I want to use rpcs.... lol
  • m

    Mike_

    12/15/2021, 6:53 PM
    ahh, looks interesting, might explore
  • j

    jensen

    12/15/2021, 6:53 PM
    It's worth it, even if the result is you know more SQL. SQL isn't going anywhere
  • l

    Lavka

    12/15/2021, 7:08 PM
    I mean, you would need to run those checks on your express server otherwise - Postgres will run them for you if you configure it right. The thing which is a bigger conceptual smell for me is the need for partial tables (profiles and profiles_private)
  • j

    jensen

    12/15/2021, 7:08 PM
    Yeah, this is unfortunate. Without column security decisions are being made for me as to how I structure my relational db, and that is not exciting
  • j

    jensen

    12/15/2021, 7:10 PM
    Although I would need to find a better example of that not working, because the profiles/profiles_private hasn't resulted in the headache I expected
  • l

    Lavka

    12/15/2021, 7:18 PM
    Yeah, you need to base your DB schema on access control first and normalization second, which can create complications in the future (new access control rules = changes in schema and data migration).
  • j

    jensen

    12/15/2021, 7:18 PM
    exactly the feeling i get
  • j

    jensen

    12/15/2021, 7:19 PM
    but I'm not against finding out what that means, since it's been pretty common to hide behind express, rails etc up until now
  • l

    Lavka

    12/15/2021, 7:24 PM
    It's almost sounds like that versioning your tables isn't the worst idea v1_profiles, v2_profiles.. - the equivalent of REST /v1/profiles, /v2/profiles. Keeping them in sync through triggers... just the idea, because you will need to remove the old "access point" in the future, but you don't want to remove it immediately because it could break active client apps (web, and mainly mobile)
1...162163164...392Latest