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 1hdoSI-0006mc-Sj for pgsql-general@arkaria.postgresql.org; Thu, 20 Jun 2019 04:13:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hdoSH-0007Zb-Jh for pgsql-general@arkaria.postgresql.org; Thu, 20 Jun 2019 04:13:45 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hdoSG-0007ZU-8C for pgsql-general@lists.postgresql.org; Thu, 20 Jun 2019 04:13:45 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hdoSD-0004q1-Be for pgsql-general@postgresql.org; Thu, 20 Jun 2019 04:13:43 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 8FFFD224E1; Thu, 20 Jun 2019 00:13:40 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 20 Jun 2019 00:13:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=f g11fSPK0pUP3fixpdP09k/gm0tyBPcTRze0KMp6aCo=; b=LhJG8TrawWJjay8UV PA6D8JM1UJ503vTwIabQ4AoRJjvX4/XygYflB7e+cy+/wScANhUZbKDUF5ppGjiX eNIqPieaeMoBeLHHWje7H9t618A/vm1tjF9tqrFK+ngWuCQwNijOXghO/q+6cjjI J4/RkY081e64sv/meHCrDQKty95d0bOa27kLB3psOh7LZgfTNXfVltNlj2pCXjBS J9QN+pZHSNtU5T3lHi7pyt4UV4rjJ4nxGKzkiJOYbxTGnOnbvaf4h883JHLxY+ws KJh7xCcI69lDOyKjXzOIosgipPNtUFvfDSfVpsiP+MQVbGiER4tkhPAuc/L674zw i24Ow== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=fg11fSPK0pUP3fixpdP09k/gm0tyBPcTRze0KMp6a Co=; b=m7juCWHr5oFfJ46Fb7alvg4HABFy19HUfVWPDmpAfFT8lBKBv6g5hKoJH uobbNcJ+YauktWJXUFzdKOqmn9VTMXqSHEtjH+ASdHdCsLG3aDDe7TUkNE4Fpot9 nBgpSIuZfelSIpCXlbT1vK3hlCvdtWEksDCNchOA26TMrkzK6MweSn08KfEcso9x vWJQ211o7aGUf4LroLwy3s93hqQxrIwxT3RPRWOZg9fYDLiW4sJBcA9xEx2Buy6j SmUeHHRzx7K3cVPaPHEmboxC7Td9O/6oxVI//jDET/KnpfERsYXz2mSeA65iQ9mN DAlpl6Fyg0PpJhWy7vr9BJMyKNBcw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrtdefgdejlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecuffhomhgrihhnpehpohhsthhgrhgvshhqlhdrohhrghdpghhithhhuhgsrdgtohhm necukfhppeejuddrvdduvddrudehtddrvddtvdenucfrrghrrghmpehmrghilhhfrhhomh eprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhenucevlhhushhtvghr ufhiiigvpedt X-ME-Proxy: Received: from [192.168.1.4] (unknown [71.212.150.202]) by mail.messagingengine.com (Postfix) with ESMTPA id B96B080060; Thu, 20 Jun 2019 00:13:39 -0400 (EDT) Subject: Re: Row data is reflected in DETAIL message when constraints fail on insert/update To: William Denton , pgsql-general@postgresql.org References: From: Adrian Klaver Message-ID: Date: Wed, 19 Jun 2019 21:13:38 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 '); > 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