Skip to content

Commit 7e3c54d

Browse files
authored
[feat] Remove expensive and unmaintained zxcvbn-go strength checker (#3133)
Signed-off-by: Tom Payne <[email protected]>
1 parent c5f25ac commit 7e3c54d

File tree

6 files changed

+0
-34
lines changed

6 files changed

+0
-34
lines changed

docs/commands/audit.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,5 @@ test_folder/ignore_this
2626

2727
| Backend | Description |
2828
|-------------------------------------------------|------------------------------------------------------------------------|
29-
| [`zxcvbn`](https://github.com/nbutton23/zxcvbn) | [zxcvbn](https://github.com/dropbox/zxcvbn) password strength checker. |
3029
| [`crunchy`](https://github.com/muesli/crunchy) | Crunchy password strength checker |
3130
| `name` | Checks if password equals the name of the secret |

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ require (
2929
github.com/mattn/go-tty v0.0.7
3030
github.com/mitchellh/go-ps v1.0.0
3131
github.com/muesli/crunchy v0.4.0
32-
github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354
3332
github.com/noborus/ov v0.40.1
3433
github.com/pquerna/otp v1.4.1-0.20241104074508-c95b6974670c
3534
github.com/schollz/closestmatch v0.0.0-20190308193919-1fbe626be92e

go.sum

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ github.com/mitchellh/go-ps v1.0.0 h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc
127127
github.com/mitchellh/go-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg=
128128
github.com/muesli/crunchy v0.4.0 h1:qdiml8gywULHBsztiSAf6rrE6EyuNasNKZ104mAaahM=
129129
github.com/muesli/crunchy v0.4.0/go.mod h1:9k4x6xdSbb7WwtAVy0iDjaiDjIk6Wa5AgUIqp+HqOpU=
130-
github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 h1:4kuARK6Y6FxaNu/BnU2OAaLF86eTVhP2hjTB6iMvItA=
131-
github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354/go.mod h1:KSVJerMDfblTH7p5MZaTt+8zaT2iEk3AkVb9PQdZuE8=
132130
github.com/noborus/guesswidth v0.4.0 h1:+PPh+Z+GM4mKmVrhYR4lpjeyBuLMSVo2arM+VErdHIc=
133131
github.com/noborus/guesswidth v0.4.0/go.mod h1:ghA6uh9RcK+uSmaDDmBMj/tRZ3BSpspDP6DMF5Xk3bc=
134132
github.com/noborus/ov v0.40.1 h1:ERWdZaik8sLpH//56YKAi5jMiILYBxVfPxKKufOtvJw=
@@ -174,7 +172,6 @@ github.com/spf13/viper v1.20.1/go.mod h1:P9Mdzt1zoHIG8m2eZQinpiBjo6kCmZSKBClNNqj
174172
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
175173
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
176174
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
177-
github.com/stretchr/testify v1.1.4/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
178175
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
179176
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
180177
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=

internal/audit/audit.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
"github.com/gopasspw/gopass/pkg/gopass"
2525
"github.com/gopasspw/gopass/pkg/termio"
2626
"github.com/muesli/crunchy"
27-
"github.com/nbutton23/zxcvbn-go"
2827
)
2928

3029
type secretGetter interface {
@@ -65,27 +64,6 @@ func New(ctx context.Context, s secretGetter) *Auditor {
6564
return cv.Check(sec.Password())
6665
},
6766
},
68-
{
69-
Name: "zxcvbn",
70-
Description: "github.com/nbutton23/zxcvbn-go",
71-
Validate: func(name string, sec gopass.Secret) error {
72-
ui := make([]string, 0, len(sec.Keys())+1)
73-
for _, k := range sec.Keys() {
74-
pw, found := sec.Get(k)
75-
if !found {
76-
continue
77-
}
78-
ui = append(ui, pw)
79-
}
80-
ui = append(ui, name)
81-
match := zxcvbn.PasswordStrength(sec.Password(), ui)
82-
if match.Score < 3 {
83-
return fmt.Errorf("weak password (%d / 4)", match.Score)
84-
}
85-
86-
return nil
87-
},
88-
},
8967
{
9068
Name: "equals-name",
9169
Description: "Checks for passwords the match the secret name",

internal/backend/crypto/age/askpass.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/gopasspw/gopass/internal/config"
1111
"github.com/gopasspw/gopass/pkg/debug"
1212
"github.com/gopasspw/gopass/pkg/pinentry/cli"
13-
"github.com/nbutton23/zxcvbn-go"
1413
"github.com/twpayne/go-pinentry/v4"
1514
"github.com/zalando/go-keyring"
1615
)
@@ -126,11 +125,6 @@ func (a *askPass) getPassphrase(reason string, repeat bool) (string, error) {
126125
}
127126
if repeat {
128127
opts = append(opts, pinentry.WithRepeat("Confirm"))
129-
opts = append(opts, pinentry.WithQualityBar(func(s string) (int, bool) {
130-
match := zxcvbn.PasswordStrength(s, nil)
131-
132-
return match.Score, true
133-
}))
134128
} else {
135129
opts = append(opts,
136130
pinentry.WithOption(pinentry.OptionAllowExternalPasswordCache),

tests/audit_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,5 @@ func TestAudit(t *testing.T) {
1818
out, err := ts.run("audit")
1919
require.Error(t, err)
2020
assert.Contains(t, out, "crunchy")
21-
assert.Contains(t, out, "zxcvbn")
2221
})
2322
}

0 commit comments

Comments
 (0)