Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getpass not working on Windows #28828

Closed
crbinz opened this issue Aug 22, 2018 · 6 comments
Closed

getpass not working on Windows #28828

crbinz opened this issue Aug 22, 2018 · 6 comments
Labels
security System security concerns and vulnerabilities system:windows Affects only Windows

Comments

@crbinz
Copy link
Contributor

crbinz commented Aug 22, 2018

Base.getpass does not appear to accept input when used on Windows (64-bit Windows 7):

               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.7.0 (2018-08-08 06:46 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/                   |  x86_64-w64-mingw32

julia> Base.getpass("Test: ")
Test: : SecretBuffer("*******")

julia> read(ans,String)
┌ Warning: a SecretBuffer was `shred!`ed by the GC; use `shred!` manually after use to minimize exposure.
└ @ Base secretbuffer.jl:169
""

Also tested under v1.0 with the same result. I've tried regular keyboard input, and pasting from the clipboard. Base.winprompt works as expected.

ref: https://discourse.julialang.org/t/how-do-i-use-getpass/13880

@mbauman mbauman added system:windows Affects only Windows security System security concerns and vulnerabilities labels Aug 22, 2018
@mbauman
Copy link
Member

mbauman commented Aug 22, 2018

Thanks for the report, and sorry about this! Looks like we're missing a seekstart here. Does the following work for you?

s = Base.getpass("Test: ")
seekstart(s)
read(s, String)

In general, winprompt is a much better solution on Windows and will be more secure.

@crbinz
Copy link
Contributor Author

crbinz commented Aug 22, 2018

That does indeed do the trick, and noted about winprompt.

@StefanKarpinski
Copy link
Member

In general, winprompt is a much better solution on Windows and will be more secure.

Can we make Base.getpass use winprompt on Windows then?

@mbauman
Copy link
Member

mbauman commented Aug 22, 2018

I really wanted to unify these, but it's just a very different API — winprompt pops up a GUI window and asks for a username and password pair. As far as I'm aware, Windows doesn't expose an API for secure entry from STDIN, so we're emulating one to the best of our ability.

@giordano
Copy link
Contributor

Can this be closed?

@KristofferC
Copy link
Member

#28832

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
security System security concerns and vulnerabilities system:windows Affects only Windows
Projects
None yet
Development

No branches or pull requests

5 participants