[PATCH] (Windows) psql echoes password when reading from pipe

From: Matthew Stickney <mtstickney(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: [PATCH] (Windows) psql echoes password when reading from pipe
Date: 2018-05-22 04:27:48
Message-ID: 502a1fff-862b-da52-1031-f68df6ed5a2d@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

This is my first time submitting a patch here; apologies in advance if I
flub the process.

On windows, if you pipe data to psql, the password prompt correctly
reads from and writes to the console, but the password text is echoed to
the console. This is because echoing is disabled on the handle for
stdin, but as part of a pipeline stdin doesn't refer to the console.
I've attached a patch that gets a handle to the console's input buffer
by opening CONIN$ instead, which corrects the problem.

I think the change is straightforward enough to apply directly, but
there's another concern that might bear discussion: SetConsoleMode can
fail, and when it does prompt input will be echoed (i.e. it's
fail-open). Is it worth check for and reporting for an error there?
Given that this is meant to be used interactively, I think the risk of
someone not noticing the echo is low.

-Matt Stickney

Attachment Content-Type Size
0001-Disable-input-echo-on-the-console-not-stdin.patch text/plain 1.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tal Glozman 2018-05-22 06:34:18 PostgreSQL and Homomorphic Encryption
Previous Message Charles Cui 2018-05-22 04:27:19 [GSoC] github repo and initial work