pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: William Denton <wdenton@gmail.com>
To: pgsql-general@postgresql.org
Subject: Re: Row data is reflected in DETAIL message when constraints fail on insert/update
Date: Wed, 19 Jun 2019 21:13:38 -0700
Message-ID: <b2afcfd3-a2c2-9bdc-3e62-a28392f0b8f6@aklaver.com> (raw)
In-Reply-To: <CAO8wz8QdKRTJUnW--AZ2N-BvJAemS+P9=Sr7zUbkO+wmAmA7LQ@mail.gmail.com>
References: <CAO8wz8QdKRTJUnW--AZ2N-BvJAemS+P9=Sr7zUbkO+wmAmA7LQ@mail.gmail.com>

On 6/19/19 8:56 PM, William Denton wrote:
> When inserting up updating a row with not null constraints that are not 
> satisfied, postgres reflects the values in the row in the error DETAIL.
> 
> postgres=# create database test;
> CREATE DATABASE
> postgres=# \c test;
> psql (11.1 (Debian 11.1-3.pgdg90+1), server 11.2)
> You are now connected to database "test" as user "postgres".
> test=# create table person (firstname text not null, lastname text not 
> null, email text not null);
> CREATE TABLE
> test=# insert into person values ('william', 'denton', null);
> ERROR:  null value in column "email" violates not-null constraint
> DETAIL:  Failing row contains (william, denton, null).
> test=# insert into person values ('william', 'denton', 
> 'email@example.com <mailto:email@example.com>');
> INSERT 0 1
> test=# update person set email = null;
> ERROR:  null value in column "email" violates not-null constraint
> DETAIL:  Failing row contains (william, denton, null).
> test=#
> 
> Is there a setting where i can disable the DETAIL field being populated 
> with row data?

See:

https://www.postgresql.org/docs/11/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-WHAT

log_error_verbosity

> 
> Currently sensitive data (PII in the case illustrated above) is being 
> leaked by the database engine and relayed up into my application where 
> is finds its way into application logs.
> 
> I have also opened a github issue with Npgsql to see if its possible to 
> suppress this DETAIL field in exceptions, but it seems this is an issue 
> that all DB drivers/clients will face. 
> https://github.com/npgsql/npgsql/issues/2501
> 
> Being able to reflect out the data on a row without doing a select may 
> be a security issue as well.
> 
> Thank you!


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (22+ messages)  latest in thread

Message-ID: <b2afcfd3-a2c2-9bdc-3e62-a28392f0b8f6@aklaver.com>
Permalink:  ../b2afcfd3-a2c2-9bdc-3e62-a28392f0b8f6@aklaver.com/
Also on:    postgresql.org/message-id/b2afcfd3-a2c2-9bdc-3e62-a28392f0b8f6@aklaver.com

 · 

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-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, wdenton@gmail.com
  Subject: Re: Row data is reflected in DETAIL message when constraints fail on insert/update
  In-Reply-To: <b2afcfd3-a2c2-9bdc-3e62-a28392f0b8f6@aklaver.com>
  References: <CAO8wz8QdKRTJUnW--AZ2N-BvJAemS+P9=Sr7zUbkO+wmAmA7LQ@mail.gmail.com> <b2afcfd3-a2c2-9bdc-3e62-a28392f0b8f6@aklaver.com>

* 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