pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add more sanity checks in SASL exchanges
Date: Sat, 10 Jul 2021 12:49:14 +0000
Message-ID: <E1m2CPy-000837-Lw@gemulon.postgresql.org> (raw)

Add more sanity checks in SASL exchanges

The following checks are added, to make the SASL infrastructure more
aware of defects when implementing new mechanisms:
- Detect that no output is generated by a mechanism if an exchange fails
in the backend, failing if there is a message waiting to be sent.
- Handle zero-length messages in the frontend.  The backend handles that
already, and SCRAM would complain if sending empty messages as this is
not authorized for this mechanism, but other mechanisms may want this
capability (the SASL specification allows that).
- Make sure that a mechanism generates a message in the middle of the
exchange in the frontend.

SCRAM, as implemented, respects all these requirements already, and the
recent refactoring of SASL done in 9fd8557 helps in documenting that in
a cleaner way.

Analyzed-by: Jacob Champion
Author: Michael Paquier
Reviewed-by: Jacob Champion
Discussion: https://postgr.es/m/3d2a6f5d50e741117d6baf83eb67ebf1a8a35a11.camel@vmware.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/44bd0126c70b5b90e8e2d604833a6476abbbffe6

Modified Files
--------------
src/backend/libpq/auth-sasl.c       |  7 +++++++
src/interfaces/libpq/fe-auth-sasl.h |  9 +++++----
src/interfaces/libpq/fe-auth.c      | 17 ++++++++++++++++-
3 files changed, 28 insertions(+), 5 deletions(-)



Message-ID: <E1m2CPy-000837-Lw@gemulon.postgresql.org>
Permalink:  ../E1m2CPy-000837-Lw@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1m2CPy-000837-Lw@gemulon.postgresql.org

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz
  Subject: Re: pgsql: Add more sanity checks in SASL exchanges
  In-Reply-To: <E1m2CPy-000837-Lw@gemulon.postgresql.org>
  References: <E1m2CPy-000837-Lw@gemulon.postgresql.org>

* 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