Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjgxk-0006Ub-Vd for pgsql-jdbc@arkaria.postgresql.org; Tue, 13 Sep 2016 06:12:57 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bjgxj-0000ua-Mb for pgsql-jdbc@arkaria.postgresql.org; Tue, 13 Sep 2016 06:12:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bjgxj-0000uI-7j for pgsql-jdbc@postgresql.org; Tue, 13 Sep 2016 06:12:55 +0000 Received: from [195.159.176.226] (helo=blaine.gmane.org) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bjgxf-0005x4-LF for pgsql-jdbc@postgresql.org; Tue, 13 Sep 2016 06:12:54 +0000 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1bjgxU-0001s6-TG for pgsql-jdbc@postgresql.org; Tue, 13 Sep 2016 08:12:40 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-jdbc@postgresql.org From: Thomas Kellerer Subject: Re: Filtering DatabaseMetaData to show only the items for which the current user has access Date: Tue, 13 Sep 2016 08:12:29 +0200 Lines: 33 Message-ID: References: <338A7B0E9A69874B9D933A0B0D2527A4E708469E@adama.fhcrc.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@blaine.gmane.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 In-Reply-To: <338A7B0E9A69874B9D933A0B0D2527A4E708469E@adama.fhcrc.org> X-Host-Lookup-Failed: Reverse DNS lookup failed for 195.159.176.226 (failed) X-Pg-Spam-Score: -1.1 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org Langley, Scott E schrieb am 13.09.2016 um 01:54: > We have a desire to hide unneeded database objects from our > database-challenged users - as they might see in a simple database > viewer application - by removing their privileges on such objects. > > It appears that many database viewing applications, e.g., > DbVisualizer, rely on what is returned by the JDBC driver’s > DatabaseMetaData methods to determine which schemas and tables to > display to the user > > Another way would be to: > > 1. Modify the information_schema views for a particular database to > only show the current user the objects for which they have > privileges. > > 2. Then, have the PostgreSQL JDBC driver populate its > DatabaseMetatData information only using the contents of the > information_schema and not query pg_catalog, pg_class, and the other > Postgres-specific system information tables. If your aim is users of SQL clients, then what's the use of that? As you can run any SQL statement inside those applications, the users can still run the query directly against pg_class and the other system tables Or they just use psql or any other tools that is not based on the JDBC driver to get that information. You can never get security right on the client side. Plus: with the driver being OpenSource, anyone can build their own version with those checks disabled, or simply use an older version of the driver. Thomas -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc