Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pcmDj-0004JD-Fw for pgsql-bugs@arkaria.postgresql.org; Thu, 16 Mar 2023 11:56:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pcmDi-0003lS-Cl for pgsql-bugs@arkaria.postgresql.org; Thu, 16 Mar 2023 11:56:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pcmDi-0003lJ-3F for pgsql-bugs@lists.postgresql.org; Thu, 16 Mar 2023 11:56:34 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pcmDe-0000uu-Q7 for pgsql-bugs@lists.postgresql.org; Thu, 16 Mar 2023 11:56:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Type:MIME-Version:References:Reply-To: Message-ID:Subject:Cc:To:Sender:From:Date:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=sZGTHKyHe1T2TOAOQR2/uvMIHmVKD3QBJTuGPcXyKK0=; b=aqfNHQb4VQWO1MPFbfWVdg9Y86 F73FrobfgTWeqa9XE+IlTZgf0pTXK1XHzmAJ5LwmjONAx3yL/1++b5VS4rMt8RxiipFbEIvYwyegu qkA6Id0a44/QsXkeVOikTgECP6ndiWsRN7JdgwkcJhEpZSEBCH+vIeO7rmzkovl8j8Cg=; Received: from depesz by depesz.com with local (Exim 4.94.2) (envelope-from ) id 1pcmDY-004gKv-QM; Thu, 16 Mar 2023 12:56:24 +0100 Date: Thu, 16 Mar 2023 12:56:24 +0100 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: Kyotaro Horiguchi Cc: pgsql-bugs@lists.postgresql.org Subject: Re: pg_read_server_files doesn't let me use pg_ls_dir() or pg_read_file? Message-ID: Reply-To: depesz@depesz.com References: <20230315.111011.205480166041302286.horikyota.ntt@gmail.com> <20230316.101104.634148126391618068.horikyota.ntt@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230316.101104.634148126391618068.horikyota.ntt@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Mar 16, 2023 at 10:11:04AM +0900, Kyotaro Horiguchi wrote: > At Wed, 15 Mar 2023 11:46:17 +0100, hubert depesz lubaczewski wrote in > > On Wed, Mar 15, 2023 at 11:10:11AM +0900, Kyotaro Horiguchi wrote: > > > At Tue, 14 Mar 2023 20:33:10 +0100, hubert depesz lubaczewski wrote > > > > OK, I get it, but then, what is the point of mentioning > > pg_read_server_files in the doc? I can just as well grant execute on the > > functions to someone. And, I tested, they don't need to be in > > pg_read_server_files. > > I believe you can confirm that the non-superuser test cannot access > /etc without the pg_read_server_files privilege. > > > postgres=> select * from pg_ls_dir('/etc'); > > ERROR: absolute path not allowed > > postgres=> select * from pg_ls_dir('../../'); > > ERROR: path must be in or below the current directory > ("current" directory...) > > Although the order of the descriptions may seem reversed, the doc > clearly states that pg_read_server_files is responsible for > controlling access outside the database cluster directory and the > log_directory for non-superusers, while GRANT EXECUTE regulates > executability for non-superusers. Ok, tested. You're right. So it was my misunderstanding. Could be that the docs could use some clarification, but otoh, it could be just as well that I suck at understanding :) Thanks a lot for the info. Best regards, depesz