From 4b8f4420e1f6086d9120b0b8518f5805c53d3008 Mon Sep 17 00:00:00 2001 From: JB Gosselin <1536838+jbgosselin@users.noreply.github.com> Date: Wed, 6 Sep 2023 10:58:31 -0400 Subject: [PATCH] Replace getpass with ui.input(hidden=True) --- gimme_aws_creds/okta_classic.py | 3 +-- gimme_aws_creds/webauthn.py | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/gimme_aws_creds/okta_classic.py b/gimme_aws_creds/okta_classic.py index 3b50bd9b..fcd090a5 100644 --- a/gimme_aws_creds/okta_classic.py +++ b/gimme_aws_creds/okta_classic.py @@ -11,7 +11,6 @@ """ import base64 import copy -import getpass import re import socket import time @@ -914,7 +913,7 @@ def _get_username_password_creds(self): # via OKTA_USERNAME env and user might not remember. for x in range(0, 5): passwd_prompt = "Okta Password for {}: ".format(username) - password = getpass.getpass(prompt=passwd_prompt) + password = self.ui.input(message=passwd_prompt, hidden=True) if len(password) > 0: break diff --git a/gimme_aws_creds/webauthn.py b/gimme_aws_creds/webauthn.py index b240186b..1ee89f0e 100644 --- a/gimme_aws_creds/webauthn.py +++ b/gimme_aws_creds/webauthn.py @@ -12,7 +12,6 @@ from __future__ import print_function, absolute_import, unicode_literals -from getpass import getpass from threading import Event, Thread from ctap_keyring_device.ctap_keyring_device import CtapKeyringDevice @@ -140,13 +139,12 @@ def _run_in_thread(self, method, *args, **kwargs): self.ui.info('Operation timed out or no valid Security Key found !') raise FIDODeviceTimeoutError - @staticmethod - def _get_pin_from_client(client): + def _get_pin_from_client(self, client): if not client.info.options.get(CtapOptions.CLIENT_PIN): return None # Prompt for PIN if needed - pin = getpass("Please enter PIN: ") + pin = self.ui.input(message="Please enter PIN: ", hidden=True) return pin @staticmethod