Skip to content

Commit af6df83

Browse files
authored
Merge pull request #1190 from tavisrudd/add-removal-notice-for-pass-prompt-driver
Add explicit removal notice + instructions for --prompt=pass
2 parents a782d74 + 9a3590b commit af6df83

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

cli/global.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"io"
66
"log"
77
"os"
8+
"strings"
89

910
"github.com/99designs/aws-vault/v7/prompt"
1011
"github.com/99designs/aws-vault/v7/vault"
@@ -115,7 +116,24 @@ func ConfigureGlobals(app *kingpin.Application) *AwsVault {
115116

116117
app.Flag("prompt", fmt.Sprintf("Prompt driver to use %v", promptsAvailable)).
117118
Envar("AWS_VAULT_PROMPT").
118-
EnumVar(&a.promptDriver, promptsAvailable...)
119+
StringVar(&a.promptDriver)
120+
121+
app.Validate(func(app *kingpin.Application) error {
122+
if a.promptDriver == "" {
123+
return nil
124+
}
125+
if a.promptDriver == "pass" {
126+
kingpin.Fatalf("--prompt=pass (or AWS_VAULT_PROMPT=pass) has been removed from aws-vault as using TOTPs without " +
127+
"a dedicated device goes against security best practices. If you wish to continue using pass, " +
128+
"add `mfa_process = pass otp <your mfa_serial>` to profiles in your ~/.aws/config file.")
129+
}
130+
for _, v := range promptsAvailable {
131+
if v == a.promptDriver {
132+
return nil
133+
}
134+
}
135+
return fmt.Errorf("--prompt value must be one of %s, got '%s'", strings.Join(promptsAvailable, ","), a.promptDriver)
136+
})
119137

120138
app.Flag("keychain", "Name of macOS keychain to use, if it doesn't exist it will be created").
121139
Default("aws-vault").

0 commit comments

Comments
 (0)