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 1hIwpb-0001kS-3q for pgsql-bugs@arkaria.postgresql.org; Tue, 23 Apr 2019 14:55:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hIwpZ-0006Q4-Du for pgsql-bugs@arkaria.postgresql.org; Tue, 23 Apr 2019 14:55:33 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1hIwpZ-0006Pp-5z for pgsql-bugs@lists.postgresql.org; Tue, 23 Apr 2019 14:55:33 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hIwpX-0006yu-0e for pgsql-bugs@lists.postgresql.org; Tue, 23 Apr 2019 14:55:32 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x3NEtSvB030634; Tue, 23 Apr 2019 10:55:28 -0400 From: Tom Lane To: Stephen Frost cc: raf@raf.org, pgsql-bugs@lists.postgresql.org Subject: Re: Possible to store invalid SCRAM-SHA-256 Passwords In-reply-to: <20190423144159.GP6197@tamriel.snowman.net> References: <016deb6b-1f0a-8e9f-1833-a8675b170aa9@postgresql.org> <4240a41f-a957-fd7d-7c24-31683f259b9d@postgresql.org> <20190422015051.GA3433@paquier.xyz> <3033.1555940554@sss.pgh.pa.us> <20190422135215.GG6197@tamriel.snowman.net> <20190422214924.pytigrzlq7mkdyzq@raf.org> <20190423144159.GP6197@tamriel.snowman.net> Comments: In-reply-to Stephen Frost message dated "Tue, 23 Apr 2019 10:42:00 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <30632.1556031328.1@sss.pgh.pa.us> Date: Tue, 23 Apr 2019 10:55:28 -0400 Message-ID: <30633.1556031328@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Stephen Frost writes: > * raf@raf.org (raf@raf.org) wrote: >> I don't think there's anything wrong with prefixing a >> password hash with an identifier for the password >> hashing scheme (and any parameters for that scheme). >> This is done all the time in many systems. It just has >> to be unambiguoous. > There isn't a way to make it unambiguous given that we accept > more-or-less anything as a plaintext password though, that would be the > issue here.. In practice, particularly with the extra validation we just added, it seems vanishingly unlikely that anyone would choose a password that just happened to look like one of the hashed formats. If somebody intentionally chooses such a password, well, it's on their heads whether the outcome is what they want. regards, tom lane