feat: add interactive prompt to put command; chore: update inquirer to only minimally required packages#8
Conversation
chore: update inquirer to only minimally required packages
| // Value can be prompted interactively to avoid saving | ||
| // sensitive data in shell history | ||
| let value = argValue ?? await promptPassword({ message: 'Value to store:', mask: true }) | ||
| if (typeof value !== 'string') { |
There was a problem hiding this comment.
this guard will never trigger since the promptPassword is Promise<String>. A empty password is may accepted -> value = "".
Solution: We could use a validate function on the prompt.
const value = argValue ?? await promptPassword({
message: 'Value to store:',
mask: true,
validate: v => v !== '' || 'Value is required',
})There was a problem hiding this comment.
This is actually intended 🙂
You can see validate being used when empty string is unacceptable:
ssm-secrets/src/commands/auth.ts
Line 22 in a636cd5
Here, however, I can see a usecase of someone adding an empty string value parameter. Would you agree with that or do you think that it never makes sense?
There was a problem hiding this comment.
@phoenix-ru Makes sense!
But do you think we should leave the guard if (typeof value !== ‘string’) { in there? It should never trigger, right?
There was a problem hiding this comment.
Yep, it should never, but it's there for the sanity sake mostly in case inquirer ever returns undefined or other bad value
Closes N/A
This PR adds an interactive prompt to the
putcommand so that sensitive data can be enteredwithout saving anything to shell history or exposing to bystanders.
Checklist:
#)