Skip to content

Added Password Prompt to operate with echo off in terminal#265

Merged
sundarshankar89 merged 3 commits intomainfrom
feature/add-secret-prompt
Sep 8, 2025
Merged

Added Password Prompt to operate with echo off in terminal#265
sundarshankar89 merged 3 commits intomainfrom
feature/add-secret-prompt

Conversation

@sundarshankar89
Copy link
Copy Markdown
Collaborator

@sundarshankar89 sundarshankar89 commented Sep 3, 2025

What does this PR do?

  • Adds a secure password prompt feature to the CLI, making user input hidden (echo off) when entering passwords.
  • Updated the README with usage instructions and a demo GIF for the new password prompt.
  • Introduces tests for validation password prompt behavior.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Sep 3, 2025

✅ 40/40 passed, 2 skipped, 1m47s total

Running from acceptance #348

Copy link
Copy Markdown

@m-abulazm m-abulazm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@asnare asnare added enhancement New feature or request documentation Improvements or additions to documentation labels Sep 3, 2025
Copy link
Copy Markdown
Contributor

@asnare asnare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly fine, albeit some small things to look at.

attempt = 0
while attempt < max_attempts:
attempt += 1
passwd = getpass.getpass(f"\033[1m{text}\033[0m: ")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, not a fan of embedding these ANSI sequences directly everywhere… they're hard to read. It's the convention for this file but I think what we having in the logging module is much more sensible.

@asnare asnare removed the request for review from nfx September 4, 2025 10:02
@sundarshankar89 sundarshankar89 merged commit 5f8823f into main Sep 8, 2025
11 checks passed
@sundarshankar89 sundarshankar89 deleted the feature/add-secret-prompt branch September 8, 2025 03:28
sundarshankar89 added a commit that referenced this pull request Oct 6, 2025
* Added Password Prompt to operate with echo off in terminal ([#265](#265)). The command-line interface now includes a secure password prompt feature, allowing users to enter sensitive information without it being visible on the screen. This is achieved through a new method that utilizes the `getpass` library to hide user input when entering passwords, taking a prompt message and an optional maximum number of attempts as parameters. The method repeatedly prompts the user for a password until a valid input is provided or the maximum number of attempts is reached, at which point it raises a `ValueError`. This addition enhances the security and usability of the interface, and its functionality is validated through new test methods that cover both successful password entry and the scenario where the maximum number of attempts is exceeded, ensuring the feature behaves as expected in various situations.
* Sniff encoding properly in XML files with a standalone directive ([#256](#256)). The XML file encoding detection has been improved to support a wider range of valid XML declarations. The regular expression used to match XML declarations has been updated to correctly handle cases where both `encoding` and `standalone` attributes are present, such as `<?xml version="1.x" encoding="xxx" standalone="yes"?>`. This change enables more accurate detection of the encoding attribute in XML files, even when a `standalone` directive is present. Additionally, test functions have been added and modified to verify this functionality, including tests for XML files with a BOM prefix and those with an XML standalone declaration, ensuring that the code can correctly read these files and detect the encoding.
@sundarshankar89 sundarshankar89 mentioned this pull request Oct 6, 2025
sundarshankar89 added a commit that referenced this pull request Oct 6, 2025
* Added Password Prompt to operate with echo off in terminal
([#265](#265)). The
command-line interface now includes a secure password prompt feature,
allowing users to enter sensitive information without it being visible
on the screen. This is achieved through a new method that utilizes the
`getpass` library to hide user input when entering passwords, taking a
prompt message and an optional maximum number of attempts as parameters.
The method repeatedly prompts the user for a password until a valid
input is provided or the maximum number of attempts is reached, at which
point it raises a `ValueError`. This addition enhances the security and
usability of the interface, and its functionality is validated through
new test methods that cover both successful password entry and the
scenario where the maximum number of attempts is exceeded, ensuring the
feature behaves as expected in various situations.
* Sniff encoding properly in XML files with a standalone directive
([#256](#256)). The
XML file encoding detection has been improved to support a wider range
of valid XML declarations. The regular expression used to match XML
declarations has been updated to correctly handle cases where both
`encoding` and `standalone` attributes are present, such as `<?xml
version="1.x" encoding="xxx" standalone="yes"?>`. This change enables
more accurate detection of the encoding attribute in XML files, even
when a `standalone` directive is present. Additionally, test functions
have been added and modified to verify this functionality, including
tests for XML files with a BOM prefix and those with an XML standalone
declaration, ensuring that the code can correctly read these files and
detect the encoding.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants