From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: cc@sse-ag.ch <cc@sse-ag.ch>
Cc: pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
Subject: Re: Potential vuln in example for "F.25.1.1. digest()"
Date: Tue, 17 Aug 2021 14:33:17 -0400
Message-ID: <1368591.1629225197@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwZVWK8J3Nw+f=ERH_2hG6iFTVkOc0ciDX1a8vnAb11+HQ@mail.gmail.com>
References: <162921671324.1653.2466671901617491685@wrigleys.postgresql.org>
<CAKFQuwZVWK8J3Nw+f=ERH_2hG6iFTVkOc0ciDX1a8vnAb11+HQ@mail.gmail.com>
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Tuesday, August 17, 2021, PG Doc comments form <noreply@postgresql.org>
> wrote:
>> in "F.25.1.1. digest()" you suggest:
>>
>> CREATE OR REPLACE FUNCTION sha1(bytea) returns text AS $$
>> SELECT encode(digest($1, 'sha1'), 'hex')
>> $$ LANGUAGE SQL STRICT IMMUTABLE;
>>
>> While this is a great example, it may expose a database app to
>> vulnerabilities if the attacker succeeds in overriding the function
>> sha1(...) in the app's user context (schema)
> You should read this:
> https://wiki.postgresql.org/wiki/A_Guide_to_CVE-2018-1058%3A_Protect_Your_Search_Path
Yeah. I can't get terribly excited about trying to make this one
example unconditionally-secure; there are dozens if not hundreds
of similar cases in our docs. Trying to make them all safe
against insecure search paths would mostly result in unreadable
examples.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-docs@postgresql.org
Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, cc@sse-ag.ch, pgsql-docs@lists.postgresql.org
Subject: Re: Potential vuln in example for "F.25.1.1. digest()"
In-Reply-To: <1368591.1629225197@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox