Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jiVQn-0003IB-0n for pgsql-bugs@arkaria.postgresql.org; Tue, 09 Jun 2020 04:00:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jiVQk-0007cH-SK for pgsql-bugs@arkaria.postgresql.org; Tue, 09 Jun 2020 04:00:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jiVQk-0007bG-KB for pgsql-bugs@lists.postgresql.org; Tue, 09 Jun 2020 04:00:06 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jiVQi-0006fJ-Ia for pgsql-bugs@lists.postgresql.org; Tue, 09 Jun 2020 04:00:06 +0000 Received: by mail-lj1-x244.google.com with SMTP id s1so23244629ljo.0 for ; Mon, 08 Jun 2020 21:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=GiVK5fPC8m+YnF8IZswAlpmBceZJBam80Cpgmn88aRk=; b=TW8Inrp+v0ZukKGSTOR8SR0YUroRQ5B5kVGvzluWU/8EvFt4Suk3on7ROBB2a8PAi4 xOBHYcfQgoxphwNjDNPhL519AngaEj4tXlB/LgnE4G1RXZTBywlXPI+AzLRoF1QaRinG 8QIaZ9BWfxehA2skaXOWAfRlml7PJcYo6xb/DijHKxxD9LKw7YuzghSvkx+X0C3/FzKI uwGIss8+m5BSIAgic14cpdloRQG+WFXencD4WVGk4p5aV0caGC7ibX9UPZ8JF8l1paAV /r36sCNhP9ANKAhlsUhl5oWMrjNX6qzlYbhrgjhFYyMwvQjrBRFdvwBMNLCaUtlgYUG1 Fwug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=GiVK5fPC8m+YnF8IZswAlpmBceZJBam80Cpgmn88aRk=; b=knHD9l9UfgFEIMSnji9vshsZ/l0yvKHQI6dRD583U7lXgh3NYuL+Wx/KOZpRM7GY2R glAA7xJNZp03l+EbHFqMNHrxgbAbvcKtt1RaDUrd0p08ArOYMFTqgfEaRvVmOyshlUwU KN3qGtIhRUAtRRW8rVIag/bQ6Gnz++VnPmItnn61A+3NkyoUCenPt+COHgZDQPJ53uA8 va2BPuVctw9svAQpo2epWlF//ti+XtIf/4kdTIpV+AK3KoogwFUBJGArsKiU+9/5JkjR lamrp5tP/Ln/ZJzHce0oZMBcGDLd1MzcG4Wy2aezCA3Sv9at2FJJ0Hxyp8ZiOtcqryhp PSYg== X-Gm-Message-State: AOAM531XFLpBoKh0txMvnPgotxeIkbKZ/sOVF5M4KVA8wsNDrbS6q32E lWferYKO+o6YM8vjnsXvdXTNSy+w X-Google-Smtp-Source: ABdhPJwCueoZbmmaoN6OHcC6Hi0LZmVWk/XnEH8a39gsH2mZGRuiqdSMIQaRMPrDNU+gKyJZks2NrQ== X-Received: by 2002:a2e:a367:: with SMTP id i7mr13568305ljn.5.1591675203256; Mon, 08 Jun 2020 21:00:03 -0700 (PDT) Received: from [1.0.0.7] ([178.155.6.254]) by smtp.gmail.com with ESMTPSA id t19sm4796883lft.47.2020.06.08.21.00.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Jun 2020 21:00:02 -0700 (PDT) Subject: Re: BUG #16486: Prompted password is ignored when password specified in connection string To: Tom Lane , "David G. Johnston" Cc: PostgreSQL mailing lists References: <16486-b9c93d71c02c4907@postgresql.org> <2090524.1591652199@sss.pgh.pa.us> <2110959.1591655226@sss.pgh.pa.us> <2142411.1591667958@sss.pgh.pa.us> From: Alexander Lakhin Message-ID: Date: Tue, 9 Jun 2020 07:00:01 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <2142411.1591667958@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello Tom, 09.06.2020 04:59, Tom Lane wrote: > The thing that was really missing here IMO is the specification that a > conninfo string overrides other command-line parameters. It's somewhat > debatable whether a -W prompt is a "command line parameter", but it > acts that way for this purpose. In any case, I'm disinclined to document > that specific interaction, because it would amount to blessing a pretty > damfool practice, which is to make your password visible on the program's > command line. (I wonder whether section 33.1.2 ought to specifically > caution against putting passwords into command-line conninfo strings.) I don't think that the main issue is with blessing such a practice, because the documentation already says about PGPASSWORD: Use of this environment variable is not recommended for security reasons, as some operating systems allow non-root users to see process environment variables via ps; ... So using the PGPASSWORD is not blessed either. And I wonder, what if we had, say PGCONNURI environment variable? Should the password specified inside be not overridable too? By the way, similar behaviour could also be observed with PGSERVICE: echo -e "[mydb]\nhost=localhost\nuser=u1\npassword=p1\n" >/tmp/service.conf PGSERVICEFILE=/tmp/service.conf PGSERVICE="mydb" psql -W In this case psql effectively ignores the input password too. So the visibility of the password is not main criteria to make it dominant. Best regards, Alexander