microsoft / microsoft/knack

prompt_pass not working on windows when using CTRL+V to paste the password string to console

Open
#160 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/prompting type/bug
Dominant language
Python
Stars
358
Forks
101
PR merge metrics
No merged PRs in 30d

Description

Issue: prompt_pass is not working on windows with CTRL+V being used to enter the input

Repro:

### CODE PART 1 ###
# ** getpass_fails.py ** #

from knack.prompting import prompt_pass
password = prompt_pass(msg="Password: ")
print(password)

Steps to repro:

  1. Copy a text to clipboard using CTRL+C e.g. "mypassword"
  2. On CMD or powershell prompt python getpass_fails.py
  3. On Password: prompt use CTRL+V to paste the copied text.

Actual Behavior:
image

Expected Behavior:
image

WORKAROUND: The issue in only in using Ctrl+V to paste. If we use console menu or right click to paste it works correctly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with knack/prompting.py at prompt_pass and reproduce the issue on Windows CMD or PowerShell using the supplied getpass_fails.py example. Trace the CTRL+V input path and verify that pasted password text is accepted correctly while the prompt retains its expected password behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.