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 1geP6r-0003fn-0m for pgsql-general@arkaria.postgresql.org; Tue, 01 Jan 2019 18:49:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1geP6o-0007qi-8s for pgsql-general@arkaria.postgresql.org; Tue, 01 Jan 2019 18:49:46 +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 1geP6n-0007qb-Td for pgsql-general@lists.postgresql.org; Tue, 01 Jan 2019 18:49:46 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1geP6l-0003cG-4H for pgsql-general@lists.postgresql.org; Tue, 01 Jan 2019 18:49:44 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 21FFB21AA2; Tue, 1 Jan 2019 13:49:42 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 01 Jan 2019 13:49:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=E SIusEBl21YMtXier8638SjfUybP8vm/DKXXeQcQNdY=; b=BVv3UlYPSi2MGns+/ CFBYnaArRjwYakUV3DWHzLNdt3WPStQ7wLpCb0g6yK3IbGSOze4oxD4+s2BwinwD rgvuCAA/p2eMKmEzkiJWte/Ykb4xPXOnOxLbtDpi984h1NfvRj/Ht4MjFpYxqYcA GMjWaW4uSuyTLNKhX7L2Mp9lG6O0XVMn0WqTSjGD99yfHMRBzii/rnYRe6Pf/n6X AtPlHdnFwB0qb+nHofF6C6NTJFjTBZmaf/e4E/NlegHor0Wa16j5iSDwDLWimB20 I76zir6nR+l+rdujOjhVgBrbcc3/cozDyvtZNvlXD7z3miP8DHPvLDAQODTD39Zj Q2GGQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=ESIusEBl21YMtXier8638SjfUybP8vm/DKXXeQcQN dY=; b=rhtsfi/hE/UpWbKpC047M2hrF9Zea/97/3m37fciTGBIkoE5Fw9y3MTLj /84cPGw7L7ByXYk74z5a0c/VjLkB9t0Ay62ep3AO4MjEvDDF35yG3k7LBW3GHx/x WED1YJ078i7b+BG75m/KVgOVJAwEK/VCJUpgRn1eDhFXiHBoZxN2kyQHA6RxgynO dM1zl8oYpiGPqtT8iy+Ml3qCXhp1huYG032MaMRigLGjACfUboIl1oDeuBNHVfiC K53m/za+VXL4pbb+uctyXWozo8xXVy7+FmtGA2MmuOvQ2Sp5FHTDp8gePfDTtt/B sUfVyBhB9yoOHhaI/Hz+Y/XyKCxdg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrudeggdduudejucdltddurdegtdekrddttd dmucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfquhht necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefuvfhfhffkffgfgggjtgfgsehtjeertddtfeejnecuhfhrohhmpeetughr ihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtg homheqnecuffhomhgrihhnpegtrghlvghnughlhidrtghomhdprgihuhgurggtrghrvgdr tghomhenucfkphepjedurddvuddvrddufeegrdefnecurfgrrhgrmhepmhgrihhlfhhroh hmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmnecuvehluhhsthgv rhfuihiivgeptd X-ME-Proxy: Received: from [192.168.1.2] (unknown [71.212.134.3]) by mail.messagingengine.com (Postfix) with ESMTPA id 5908B10087; Tue, 1 Jan 2019 13:49:41 -0500 (EST) Subject: Re: Thoughts on row-level security for webapps? To: Siegfried Bilstein , pgsql-general@lists.postgresql.org References: From: Adrian Klaver Message-ID: <79848fa2-ed90-4f06-04f9-a068c341a682@aklaver.com> Date: Tue, 1 Jan 2019 10:49:40 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 12/31/18 8:57 AM, 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. So there is still user information being passed in, correct? > > 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. Is this a > common usage pattern for SQL security? Any gotchas relying on RLS? The ROLE will be determined by the user name used to make the connection. Is it possible to change the connection login depending on the website user privileges? > > -- > Siggy Bilstein > CTO ofAyuda Care > Book some time with me! -- Adrian Klaver adrian.klaver@aklaver.com