Pricing Blog

additional security on front end

  • petermac7886-1251636004998352927

    petermac

    1 year ago

    Hi, I have RLS setup on Supabse and it works well. Is it recommmended to add additional security on front end, e.g. modifying API call to only retrieve logged in user details or filtering the api data to only retrieve the logged in user details. I am just worried on the off chance if I ever misconfigured RLS on a live site or something and wondering if people add additional security on the front end, or is this overkill?
  • lucasg-1251638303904628737

    Lucas G

    1 year ago

    I don’t know how you would further secure a front end without involving the backend
  • lucasg-1251638832496115732

    Lucas G

    1 year ago

    I guess filtering could add a layer but it would depend on how you have your database set up
  • Interested to hear from others on this
  • max.kayr-1251795191304687636

    Max

    1 year ago

    I think that in general it is good practice to only fetch the data that you are interested in at that moment. So if I want to fetch my user details, I don't fetch all user profiles and let RLS do the filtering. I fetch the details of a specific user (by id probably). But that does not really enhance security. If you mess up your RLS, that's it then 😉
  • andreasmoller-1252368947953795072

    Andreas Møller

    1 year ago

    As a rule you always protect the data on the backend. Once it has reached the users browser it is no longer secure (from the user).

    Security on the frontend is mostly about making sure that you are not loading any potential malicious scripts (https://en.wikipedia.org/wiki/Cross-site_scripting).
  • andreasmoller-1252369479548010518

    Andreas Møller

    1 year ago

    You can ofcause add extra measures like the one you mentioned, but they can actually be more of a risk.

    By adding the extra filter you could potentially hide the fact that you have misconfigured your RLS, there by cause the very security hole you tried to protect against.