console-rs / dialoguer

Rust utility library for nice command line prompts and similar things
MIT License
1.31k stars 143 forks source link

Password prompt freezes program when a long password is entered #270

Open valentinegb opened 1 year ago

valentinegb commented 1 year ago

I have the following code:

let token: String = Password::with_theme(&ColorfulTheme::default())
    .with_prompt("Please enter your token")
    .interact()?;

Running the code, I paste a 1,571 characters long token into my terminal, and then the program becomes unresponsive.

Using Input does not freeze but it cuts off most of the token and isn't ideal for entering very sensitive information.

I am using dialoguer 0.10.4 on macOS 14.0 Beta (23A5286i).

Gordon01 commented 1 year ago

Tested on Windows and Linux, 1 571 chars and more - UI responsive as usual.

valentinegb commented 1 year ago

Tested on Windows and Linux, 1 571 chars and more - UI responsive as usual.

Is anyone else able to test it on macOS?

Gordon01 commented 1 year ago

Do you build in debug or release?

Can you run it under strace and possibly see what is happening during the slowdown?

valentinegb commented 1 year ago

While I'm developing I build in debug but when making a release I build in release, the problem happens either way. I don't have strace, looking it up it looks like it's only on Linux but I'm on macOS.

TeraTorajiro commented 6 months ago

I also encountered a similar phenomenon. When using the Input, I noticed that the pasted text was shortened to about 1000 characters.

I confirmed that the application freezes when using the Password.

I am using dialoguer 0.11.0 on macOS 14.2.1