Skip to content

Commit

Permalink
Remove random bytes as that also takes time
Browse files Browse the repository at this point in the history
  • Loading branch information
jefferai committed Oct 27, 2018
1 parent 7591209 commit e40dd1c
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions builtin/credential/userpass/path_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"fmt"
"strings"

uuid "github.com/hashicorp/go-uuid"
"github.com/hashicorp/vault/helper/cidrutil"
"github.com/hashicorp/vault/helper/policyutil"
"github.com/hashicorp/vault/logical"
Expand Down Expand Up @@ -80,12 +79,9 @@ func (b *backend) pathLogin(ctx context.Context, req *logical.Request, d *framew
userPassword = user.PasswordHash
}
} else {
userPassword, err = uuid.GenerateRandomBytes(16)
if err != nil {
// This is still acceptable as bcrypt will still make sure it takes
// a long time, it's just nicer to be random if possible
userPassword = []byte("dummy")
}
// This is still acceptable as bcrypt will still make sure it takes
// a long time, it's just nicer to be random if possible
userPassword = []byte("dummy")
}

// Check for a password match. Check for a hash collision for Vault 0.2+,
Expand Down

0 comments on commit e40dd1c

Please sign in to comment.