From: Michael Paquier <michael@paquier.xyz>
To: Jonathan S. Katz <jkatz@postgresql.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@lists.postgresql.org, Stephen Frost <sfrost@snowman.net>
Subject: Re: Possible to store invalid SCRAM-SHA-256 Passwords
Date: Tue, 23 Apr 2019 15:57:01 +0900
Message-ID: <20190423065701.GL2712@paquier.xyz> (raw)
In-Reply-To: <20190423021018.GF2712@paquier.xyz>
References: <4240a41f-a957-fd7d-7c24-31683f259b9d@postgresql.org>
<20190422015051.GA3433@paquier.xyz>
<3033.1555940554@sss.pgh.pa.us>
<5a93333c-dde6-ee52-f870-4dccfc50eb6f@postgresql.org>
<30284.1555972921@sss.pgh.pa.us>
<15140775-08c3-45bd-6dab-fdcd290d1bf0@postgresql.org>
<20190423010142.GE2712@paquier.xyz>
<10698.1555981849@sss.pgh.pa.us>
<265876b8-1a72-89cd-bdcf-e641d93e166c@postgresql.org>
<20190423021018.GF2712@paquier.xyz>
On Tue, Apr 23, 2019 at 11:10:18AM +0900, Michael Paquier wrote:
> That's a hard morning... Yes you are right and I can see the failure.
> By the way, grouping everything in one patch looks more adapted to me
> as this tightens all the checks for the different verifier types.
The afternoon has been better. I have double-checked your patch and
committed it down to v10. Now, there are two things which may need
extra handling:
- Do we add a note in the release notes about that with a SQL query
checking the state of pg_authid?
- In ~9.6 we include in md5.h a macro which does not care about hex
characters in the MD5 hash. I think that we should fix that as well,
or perhaps that's not worth caring per the lack of complaints?
Attached is what would be needed.
--
Michael
Attachments:
[text/x-diff] md5-check-96-v1.patch (584B, ../20190423065701.GL2712@paquier.xyz/2-md5-check-96-v1.patch)
download | inline diff:diff --git a/src/include/libpq/md5.h b/src/include/libpq/md5.hindex f3eec8b4f4..fac2636c07 100644--- a/src/include/libpq/md5.h+++ b/src/include/libpq/md5.h@@ -16,10 +16,12 @@
#ifndef PG_MD5_H
#define PG_MD5_H
+#define MD5_PASSWD_CHARSET "0123456789abcdef"
#define MD5_PASSWD_LEN 35
#define isMD5(passwd) (strncmp(passwd, "md5", 3) == 0 && \
- strlen(passwd) == MD5_PASSWD_LEN)+ strlen(passwd) == MD5_PASSWD_LEN && \+ strspn(passwd + 3, MD5_PASSWD_CHARSET) == MD5_PASSWD_LEN - 3)
extern bool pg_md5_hash(const void *buff, size_t len, char *hexsum);
[application/pgp-signature] signature.asc (832B, ../20190423065701.GL2712@paquier.xyz/3-signature.asc)
download
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-bugs@postgresql.org
Cc: michael@paquier.xyz, jkatz@postgresql.org, tgl@sss.pgh.pa.us, sfrost@snowman.net
Subject: Re: Possible to store invalid SCRAM-SHA-256 Passwords
In-Reply-To: <20190423065701.GL2712@paquier.xyz>
* 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