Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gedoU-00011i-HC for pgsql-general@arkaria.postgresql.org; Wed, 02 Jan 2019 10:31:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gedoT-00048X-25 for pgsql-general@arkaria.postgresql.org; Wed, 02 Jan 2019 10:31:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gedoS-00048Q-Ml for pgsql-general@lists.postgresql.org; Wed, 02 Jan 2019 10:31:48 +0000 Received: from hermes.gatewaynet.com ([193.92.121.98]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gedoO-00081u-Dm for pgsql-general@lists.postgresql.org; Wed, 02 Jan 2019 10:31:47 +0000 Received: from smadev.internal.net (pc131.internal.net [10.9.200.131]) by hermes.gatewaynet.com (8.14.3/8.14.3/Debian-9.4) with ESMTP id x02AVYeK029803 for ; Wed, 2 Jan 2019 12:31:39 +0200 Received: from smadev.internal.net (smadev [10.9.200.131]) by smadev.internal.net (8.15.2/8.15.2) with ESMTP id x02AVY8S019402 for ; Wed, 2 Jan 2019 12:31:34 +0200 (EET) (envelope-from achill@matrix.gatewaynet.com) Subject: Re: Thoughts on row-level security for webapps? To: pgsql-general@lists.postgresql.org References: From: Achilleas Mantzios Message-ID: <75a43cb2-2e87-2628-ea69-c3b69ee997f5@matrix.gatewaynet.com> Date: Wed, 2 Jan 2019 12:31:34 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------1E9E71EC8530522141EDB57A" Content-Language: en-US X-Virus-Scanned: clamav-milter 0.98.7 at hermes X-Virus-Status: Clean X-Spam-Status: No, score=-25.0 required=5.0 tests=ALL_TRUSTED,DYN_HAM_COORD, DYN_HAM_IT,DYN_HAM_NAUTICAL,DYN_SPAM_SUBJ,HTML_MESSAGE autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on hermes.gatewaynet.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------1E9E71EC8530522141EDB57A Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 31/12/18 6:57 μ.μ., Siegfried Bilstein wrote: > Hi all, > > I'm evaluating using a tool called Postgraphile that generates a GraphSQL server from a postgres setup. The recommended way of handling security is to implement RLS within postgres and simply have > the webserver take a cookie or similar and define which user is querying data. > > I've normally built webapps like this: pull out user id from a session cookie -> the API endpoint verifies the user and whether or not it has access to the given data -> app code mutates the data. > > With Postgraphile the request specifies the mutation and the server processes the request and relies on Postgres to determine if the user has correct access rights. > > It seems like I would need to create a ROLE for every single member that signs up for my website which I'm a little concerned about. Why? > Is this a common usage pattern for SQL security? Any gotchas relying on RLS? > > -- > Siggy Bilstein > CTO ofAyuda Care > Book some time with me! -- Achilleas Mantzios IT DEV Lead IT DEPT Dynacom Tankers Mgmt --------------1E9E71EC8530522141EDB57A Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
On 31/12/18 6:57 μ.μ., Siegfried Bilstein wrote:
Hi all, 

I'm evaluating using a tool called Postgraphile that generates a GraphSQL server from a postgres setup. The recommended way of handling security is to implement RLS within postgres and simply have the webserver take a cookie or similar and define which user is querying data. 

I've normally built webapps like this: pull out user id from a session cookie -> the API endpoint verifies the user and whether or not it has access to the given data -> app code mutates the data. 

With Postgraphile the request specifies the mutation and the server processes the request and relies on Postgres to determine if the user has correct access rights. 

It seems like I would need to create a ROLE for every single member that signs up for my website which I'm a little concerned about.

Why?

Is this a common usage pattern for SQL security? Any gotchas relying on RLS?

--
Siggy Bilstein
CTO of Ayuda Care


-- 
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt
--------------1E9E71EC8530522141EDB57A--