fix password comparison too slow (#17874) (#17897)

Signed-off-by: kejiang <ke.jiang@zilliz.com>

Co-authored-by: kejiang <ke.jiang@zilliz.com>
pull/17931/head
codeman 2022-06-29 20:02:18 +08:00 committed by GitHub
parent 991038a3a6
commit 95a3830dc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 274 additions and 212 deletions

3
.gitignore vendored
View File

@ -14,6 +14,8 @@ internal/core/build/*
**/.idea/*
internal/msgstream/pulsarms/client-cpp/build/
internal/msgstream/pulsarms/client-cpp/build/*
internal/kv/rocksdb/cwrapper/output/
tests/python_client/default.etcd/
# vscode generated files
.vscode
@ -55,6 +57,7 @@ lib/
.DS_Store
*.sw[po]
cwrapper_build
cwrapper_rocksdb_build/
**/.clangd/*
**/compile_commands.json
**/.lint

View File

@ -280,9 +280,12 @@ message ClearCredUsersCacheRequest {
message CredentialInfo {
string username = 1;
// encrypted by bcrypt (for higher security level)
string encrypted_password = 2;
string tenant = 3;
bool is_super = 4;
// encrypted by sha256 (for good performance in cache mapping)
string sha256_password = 5;
}
message ListPolicyRequest {

View File

@ -2361,10 +2361,13 @@ func (m *ClearCredUsersCacheRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_ClearCredUsersCacheRequest proto.InternalMessageInfo
type CredentialInfo struct {
Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
EncryptedPassword string `protobuf:"bytes,2,opt,name=encrypted_password,json=encryptedPassword,proto3" json:"encrypted_password,omitempty"`
Tenant string `protobuf:"bytes,3,opt,name=tenant,proto3" json:"tenant,omitempty"`
IsSuper bool `protobuf:"varint,4,opt,name=is_super,json=isSuper,proto3" json:"is_super,omitempty"`
Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
// encrypted by bcrypt (for higher security level)
EncryptedPassword string `protobuf:"bytes,2,opt,name=encrypted_password,json=encryptedPassword,proto3" json:"encrypted_password,omitempty"`
Tenant string `protobuf:"bytes,3,opt,name=tenant,proto3" json:"tenant,omitempty"`
IsSuper bool `protobuf:"varint,4,opt,name=is_super,json=isSuper,proto3" json:"is_super,omitempty"`
// encrypted by sha256 (for good performance in cache mapping)
Sha256Password string `protobuf:"bytes,5,opt,name=sha256_password,json=sha256Password,proto3" json:"sha256_password,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -2423,6 +2426,13 @@ func (m *CredentialInfo) GetIsSuper() bool {
return false
}
func (m *CredentialInfo) GetSha256Password() string {
if m != nil {
return m.Sha256Password
}
return ""
}
type ListPolicyRequest struct {
// Not useful for now
Base *commonpb.MsgBase `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"`
@ -2554,139 +2564,140 @@ func init() {
func init() { proto.RegisterFile("internal.proto", fileDescriptor_41f4a519b878ee3b) }
var fileDescriptor_41f4a519b878ee3b = []byte{
// 2137 bytes of a gzipped FileDescriptorProto
// 2153 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x59, 0xcd, 0x73, 0x1c, 0x47,
0x15, 0xcf, 0xec, 0xac, 0xb4, 0xbb, 0x6f, 0x57, 0xab, 0x55, 0x5b, 0x76, 0xc6, 0xb2, 0x93, 0xc8,
0x93, 0x00, 0xc2, 0x26, 0xb6, 0x51, 0x42, 0x92, 0x02, 0x0a, 0xc7, 0xd2, 0x06, 0xb3, 0xe5, 0x0f,
0xc4, 0xc8, 0x71, 0x15, 0x5c, 0xa6, 0x7a, 0x77, 0x5a, 0xab, 0xc6, 0x33, 0xd3, 0xe3, 0xee, 0x1e,
0xc9, 0xeb, 0x13, 0x07, 0x4e, 0x50, 0x70, 0xe3, 0x42, 0x15, 0x9c, 0xf9, 0x0f, 0xb8, 0x41, 0x15,
0xa7, 0x9c, 0x38, 0x71, 0xe1, 0x5f, 0xa1, 0x38, 0x50, 0xfd, 0x31, 0xbb, 0xb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0xd0, 0x49, 0x95, 0x1a, 0xf5, 0x7f,
0x61, 0x9e, 0xda, 0xb6, 0xa6, 0xc9, 0xd0, 0xf2, 0x6b, 0x1f, 0x43, 0xab, 0xf8, 0xa7, 0x11, 0xf5,
0xa0, 0x33, 0x48, 0x42, 0xa1, 0xc6, 0xd1, 0x30, 0x19, 0xf7, 0x5e, 0x43, 0x6d, 0x68, 0xfc, 0x98,
0xe0, 0x48, 0xec, 0x4f, 0x7a, 0x16, 0xea, 0x40, 0xf3, 0xee, 0x30, 0xa1, 0x2c, 0xc6, 0x51, 0xaf,
0x76, 0x6d, 0x13, 0x56, 0x8e, 0xfc, 0x04, 0x20, 0x45, 0x3c, 0x7a, 0x28, 0xbd, 0x09, 0x7a, 0xaf,
0xa1, 0x65, 0x68, 0x6f, 0xd3, 0x28, 0x8b, 0x13, 0x4d, 0xb0, 0xb6, 0x3e, 0xfa, 0xf9, 0x87, 0xe3,
0x50, 0xec, 0x67, 0x43, 0x69, 0xf0, 0x4d, 0xed, 0xc1, 0x7b, 0x21, 0x35, 0x5f, 0x37, 0xf3, 0xb2,
0xbb, 0xa9, 0x9c, 0x2a, 0x96, 0xe9, 0x70, 0xb8, 0xa8, 0x28, 0xef, 0xff, 0x37, 0x00, 0x00, 0xff,
0xff, 0xbf, 0xfd, 0xd1, 0x3d, 0xc3, 0x1d, 0x00, 0x00,
}

View File

@ -47,6 +47,7 @@ message InvalidateCredCacheRequest {
message UpdateCredCacheRequest {
common.MsgBase base = 1;
string username = 2;
// password stored in cache
string password = 3;
}

View File

@ -193,12 +193,13 @@ func (m *InvalidateCredCacheRequest) GetUsername() string {
}
type UpdateCredCacheRequest struct {
Base *commonpb.MsgBase `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"`
Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Base *commonpb.MsgBase `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"`
Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
// password stored in cache
Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *UpdateCredCacheRequest) Reset() { *m = UpdateCredCacheRequest{} }

View File

@ -208,6 +208,6 @@ message GetCredentialResponse {
common.Status status = 1;
// username
string username = 2;
// password
// password stored in etcd/mysql
string password = 3;
}

View File

@ -604,7 +604,7 @@ type GetCredentialResponse struct {
Status *commonpb.Status `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
// username
Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
// password
// password stored in etcd/mysql
Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`

View File

@ -37,7 +37,7 @@ func validAuth(ctx context.Context, authorization []string) bool {
return false
}
return crypto.PasswordVerify(password, credInfo.EncryptedPassword)
return crypto.PasswordVerify(password, credInfo)
}
func validSourceID(ctx context.Context, authorization []string) bool {

View File

@ -3726,8 +3726,8 @@ func (node *Proxy) UpdateCredentialCache(ctx context.Context, request *proxypb.U
zap.String("username", request.Username))
credInfo := &internalpb.CredentialInfo{
Username: request.Username,
EncryptedPassword: request.Password,
Username: request.Username,
Sha256Password: request.Password,
}
if globalMetaCache != nil {
globalMetaCache.UpdateCredential(credInfo) // no need to return error, though credential may be not cached
@ -3795,6 +3795,7 @@ func (node *Proxy) CreateCredential(ctx context.Context, req *milvuspb.CreateCre
credInfo := &internalpb.CredentialInfo{
Username: req.Username,
EncryptedPassword: encryptedPassword,
Sha256Password: crypto.SHA256(rawPassword, req.Username),
}
result, err := node.rootCoord.CreateCredential(ctx, credInfo)
if err != nil { // for error like conntext timeout etc.
@ -3842,7 +3843,7 @@ func (node *Proxy) UpdateCredential(ctx context.Context, req *milvuspb.UpdateCre
Reason: "found no credential:" + req.Username,
}, nil
}
if !crypto.PasswordVerify(rawOldPassword, oldCredInfo.EncryptedPassword) {
if !crypto.PasswordVerify(rawOldPassword, oldCredInfo) {
return &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UpdateCredentialFailure,
Reason: "old password is not correct:" + req.Username,
@ -3859,6 +3860,7 @@ func (node *Proxy) UpdateCredential(ctx context.Context, req *milvuspb.UpdateCre
}
updateCredReq := &internalpb.CredentialInfo{
Username: req.Username,
Sha256Password: crypto.SHA256(rawNewPassword, req.Username),
EncryptedPassword: encryptedPassword,
}
result, err := node.rootCoord.UpdateCredential(ctx, updateCredReq)

View File

@ -518,11 +518,12 @@ func (m *MetaCache) GetCredentialInfo(ctx context.Context, username string) (*in
EncryptedPassword: resp.Password,
}
m.UpdateCredential(credInfo)
return credInfo, nil
}
return &internalpb.CredentialInfo{
Username: credInfo.Username,
EncryptedPassword: credInfo.EncryptedPassword,
Username: credInfo.Username,
Sha256Password: credInfo.Sha256Password,
}, nil
}
@ -547,13 +548,13 @@ func (m *MetaCache) UpdateCredential(credInfo *internalpb.CredentialInfo) {
defer m.credMut.Unlock()
// update credMap
username := credInfo.Username
password := credInfo.EncryptedPassword
_, ok := m.credMap[username]
if !ok {
m.credMap[username] = &internalpb.CredentialInfo{}
}
m.credMap[username].Username = username
m.credMap[username].EncryptedPassword = password
m.credMap[username].Sha256Password = credInfo.Sha256Password
m.credMap[username].EncryptedPassword = credInfo.EncryptedPassword
}
func (m *MetaCache) UpdateCredUsersListCache(usernames []string) {

View File

@ -2082,7 +2082,9 @@ func TestProxy(t *testing.T) {
getResp, err := rootCoordClient.GetCredential(ctx, getCredentialReq)
assert.NoError(t, err)
assert.Equal(t, commonpb.ErrorCode_Success, getResp.Status.ErrorCode)
assert.True(t, crypto.PasswordVerify(newPassword, getResp.Password))
assert.True(t, crypto.PasswordVerify(newPassword, &internalpb.CredentialInfo{
EncryptedPassword: getResp.Password,
}))
getCredentialReq.Username = "("
getResp, err = rootCoordClient.GetCredential(ctx, getCredentialReq)

View File

@ -2837,7 +2837,7 @@ func (c *Core) UpdateCredCache(ctx context.Context, credInfo *internalpb.Credent
SourceID: c.session.ServerID,
},
Username: credInfo.Username,
Password: credInfo.EncryptedPassword,
Password: credInfo.Sha256Password,
}
return c.proxyClientManager.UpdateCredentialCache(ctx, &req)
}
@ -2862,22 +2862,21 @@ func (c *Core) CreateCredential(ctx context.Context, credInfo *internalpb.Creden
if cred, _ := c.MetaTable.getCredential(credInfo.Username); cred != nil {
return failStatus(commonpb.ErrorCode_CreateCredentialFailure, "user already exists:"+credInfo.Username), nil
}
// update proxy's local cache
err := c.ClearCredUsersCache(ctx)
if err != nil {
log.Error("CreateCredential clear credential username list cache failed", zap.String("role", typeutil.RootCoordRole),
zap.String("username", credInfo.Username), zap.Error(err))
metrics.RootCoordDDLReqCounter.WithLabelValues(method, metrics.FailLabel).Inc()
return failStatus(commonpb.ErrorCode_CreateCredentialFailure, "CreateCredential failed: "+err.Error()), nil
}
// insert to db
err = c.MetaTable.AddCredential(credInfo)
err := c.MetaTable.AddCredential(credInfo)
if err != nil {
log.Error("CreateCredential save credential failed", zap.String("role", typeutil.RootCoordRole),
zap.String("username", credInfo.Username), zap.Error(err))
metrics.RootCoordDDLReqCounter.WithLabelValues(method, metrics.FailLabel).Inc()
return failStatus(commonpb.ErrorCode_CreateCredentialFailure, "CreateCredential failed: "+err.Error()), nil
}
// update proxy's local cache
err = c.UpdateCredCache(ctx, credInfo)
if err != nil {
log.Warn("CreateCredential add cache failed", zap.String("role", typeutil.RootCoordRole),
zap.String("username", credInfo.Username), zap.Error(err))
metrics.RootCoordDDLReqCounter.WithLabelValues(method, metrics.FailLabel).Inc()
}
log.Debug("CreateCredential success", zap.String("role", typeutil.RootCoordRole),
zap.String("username", credInfo.Username))
@ -2923,18 +2922,18 @@ func (c *Core) UpdateCredential(ctx context.Context, credInfo *internalpb.Creden
tr := timerecord.NewTimeRecorder(method)
log.Debug("UpdateCredential", zap.String("role", typeutil.RootCoordRole),
zap.String("username", credInfo.Username))
// update proxy's local cache
err := c.UpdateCredCache(ctx, credInfo)
// update data on storage
err := c.MetaTable.AddCredential(credInfo)
if err != nil {
log.Error("UpdateCredential update credential cache failed", zap.String("role", typeutil.RootCoordRole),
log.Error("UpdateCredential save credential failed", zap.String("role", typeutil.RootCoordRole),
zap.String("username", credInfo.Username), zap.Error(err))
metrics.RootCoordDDLReqCounter.WithLabelValues(method, metrics.FailLabel).Inc()
return failStatus(commonpb.ErrorCode_UpdateCredentialFailure, "UpdateCredential failed: "+err.Error()), nil
}
// update data on storage
err = c.MetaTable.AddCredential(credInfo)
// update proxy's local cache
err = c.UpdateCredCache(ctx, credInfo)
if err != nil {
log.Error("UpdateCredential save credential failed", zap.String("role", typeutil.RootCoordRole),
log.Error("UpdateCredential update cache failed", zap.String("role", typeutil.RootCoordRole),
zap.String("username", credInfo.Username), zap.Error(err))
metrics.RootCoordDDLReqCounter.WithLabelValues(method, metrics.FailLabel).Inc()
return failStatus(commonpb.ErrorCode_UpdateCredentialFailure, "UpdateCredential failed: "+err.Error()), nil
@ -2953,24 +2952,22 @@ func (c *Core) DeleteCredential(ctx context.Context, in *milvuspb.DeleteCredenti
metrics.RootCoordDDLReqCounter.WithLabelValues(method, metrics.TotalLabel).Inc()
tr := timerecord.NewTimeRecorder(method)
log.Debug("DeleteCredential", zap.String("role", typeutil.RootCoordRole),
zap.String("username", in.Username))
// invalidate proxy's local cache
err := c.ExpireCredCache(ctx, in.Username)
if err != nil {
log.Error("DeleteCredential expire credential cache failed", zap.String("role", typeutil.RootCoordRole),
zap.String("username", in.Username), zap.Error(err))
metrics.RootCoordDDLReqCounter.WithLabelValues(method, metrics.FailLabel).Inc()
return failStatus(commonpb.ErrorCode_DeleteCredentialFailure, "DeleteCredential failed: "+err.Error()), nil
}
// delete data on storage
err = c.MetaTable.DeleteCredential(in.Username)
err := c.MetaTable.DeleteCredential(in.Username)
if err != nil {
log.Error("DeleteCredential remove credential failed", zap.String("role", typeutil.RootCoordRole),
zap.String("username", in.Username), zap.Error(err))
metrics.RootCoordDDLReqCounter.WithLabelValues(method, metrics.FailLabel).Inc()
return failStatus(commonpb.ErrorCode_DeleteCredentialFailure, "DeleteCredential failed: "+err.Error()), err
}
// invalidate proxy's local cache
err = c.ExpireCredCache(ctx, in.Username)
if err != nil {
log.Error("DeleteCredential expire credential cache failed", zap.String("role", typeutil.RootCoordRole),
zap.String("username", in.Username), zap.Error(err))
metrics.RootCoordDDLReqCounter.WithLabelValues(method, metrics.FailLabel).Inc()
return failStatus(commonpb.ErrorCode_DeleteCredentialFailure, "DeleteCredential failed: "+err.Error()), nil
}
log.Debug("DeleteCredential success", zap.String("role", typeutil.RootCoordRole),
zap.String("username", in.Username))

View File

@ -1,17 +1,28 @@
package crypto
import (
"crypto/sha256"
"encoding/base64"
"encoding/hex"
"github.com/milvus-io/milvus/internal/log"
"github.com/milvus-io/milvus/internal/proto/internalpb"
"go.uber.org/zap"
"golang.org/x/crypto/bcrypt"
)
func SHA256(src string, salt string) string {
h := sha256.New()
h.Write([]byte(src + salt))
sum := h.Sum(nil)
s := hex.EncodeToString(sum)
return s
}
// PasswordEncrypt encrypt password
func PasswordEncrypt(pwd string) (string, error) {
bytes, err := bcrypt.GenerateFromPassword([]byte(pwd), bcrypt.DefaultCost)
bytes, err := bcrypt.GenerateFromPassword([]byte(pwd), bcrypt.MinCost)
if err != nil {
return "", err
}
@ -19,9 +30,16 @@ func PasswordEncrypt(pwd string) (string, error) {
return string(bytes), err
}
// PasswordVerify verify encrypted password
func PasswordVerify(pwd, hashPwd string) bool {
err := bcrypt.CompareHashAndPassword([]byte(hashPwd), []byte(pwd))
// PasswordVerify verify password
func PasswordVerify(rawPwd string, credInfo *internalpb.CredentialInfo) bool {
// 1. hit cache
if credInfo.Sha256Password != "" {
encryped := SHA256(rawPwd, credInfo.Username)
return encryped == credInfo.Sha256Password
}
// 2. miss cache, verify against encrypted password from etcd
err := bcrypt.CompareHashAndPassword([]byte(credInfo.EncryptedPassword), []byte(rawPwd))
if err != nil {
log.Error("Verify password failed", zap.Error(err))
}

View File

@ -1,42 +1,65 @@
package crypto
import (
"encoding/json"
"fmt"
"testing"
"github.com/golang/protobuf/proto"
"github.com/milvus-io/milvus/internal/proto/internalpb"
"github.com/milvus-io/milvus/internal/util"
"github.com/stretchr/testify/assert"
"golang.org/x/crypto/bcrypt"
)
func TestPasswordVerify(t *testing.T) {
func TestPasswordVerify_HitCache(t *testing.T) {
wrongPassword := "test_my_name"
correctPassword := "test_my_pass_new"
hashedPass, _ := PasswordEncrypt(correctPassword)
assert.True(t, PasswordVerify(correctPassword, "$2a$10$3H9DLiHyPxJ29bMWRNyueOrGkbzJfE3BAR159ju3UetytAoKk7Ne2"))
assert.False(t, PasswordVerify(wrongPassword, hashedPass))
credInfo := &internalpb.CredentialInfo{
Username: "root",
Sha256Password: "bcca79df9650cef1d7ed9f63449d7f8a27843d2678f5666f38ca65ab77d99a13",
}
assert.True(t, PasswordVerify(correctPassword, credInfo))
assert.False(t, PasswordVerify(wrongPassword, credInfo))
}
func TestMarshalAndPasswordVerify(t *testing.T) {
encryptedRootPassword, _ := PasswordEncrypt(util.DefaultRootPassword)
credInfo := &internalpb.CredentialInfo{Username: util.UserRoot, EncryptedPassword: encryptedRootPassword}
v, _ := proto.Marshal(&internalpb.CredentialInfo{EncryptedPassword: credInfo.EncryptedPassword})
fmt.Println(string(v))
credentialInfo := internalpb.CredentialInfo{}
proto.Unmarshal(v, &credentialInfo)
assert.True(t, PasswordVerify(util.DefaultRootPassword, credentialInfo.EncryptedPassword))
func TestPasswordVerify_MissCache(t *testing.T) {
wrongPassword := "test_my_name"
correctPassword := "test_my_pass_new"
credInfo := &internalpb.CredentialInfo{
EncryptedPassword: "$2a$10$3H9DLiHyPxJ29bMWRNyueOrGkbzJfE3BAR159ju3UetytAoKk7Ne2",
}
assert.True(t, PasswordVerify(correctPassword, credInfo))
assert.False(t, PasswordVerify(wrongPassword, credInfo))
}
func TestJsonMarshalAndPasswordVerify(t *testing.T) {
encryptedRootPassword, _ := PasswordEncrypt(util.DefaultRootPassword)
credInfo := &internalpb.CredentialInfo{Username: util.UserRoot, EncryptedPassword: encryptedRootPassword}
v, _ := json.Marshal(&internalpb.CredentialInfo{EncryptedPassword: credInfo.EncryptedPassword})
fmt.Println(string(v))
//func BenchmarkPasswordVerify(b *testing.B) {
// correctPassword := "test_my_pass_new"
// credInfo := &internalpb.CredentialInfo{
// Username: "root",
// Sha256Password: "bcca79df9650cef1d7ed9f63449d7f8a27843d2678f5666f38ca65ab77d99a13",
// }
// b.ResetTimer()
// for n := 0; n < b.N; n++ {
// PasswordVerify(correctPassword, credInfo)
// }
//}
credentialInfo := internalpb.CredentialInfo{}
json.Unmarshal(v, &credentialInfo)
assert.True(t, PasswordVerify(util.DefaultRootPassword, credentialInfo.EncryptedPassword))
func TestBcryptCompare(t *testing.T) {
wrongPassword := "test_my_name"
correctPassword := "test_my_pass_new"
err := bcrypt.CompareHashAndPassword([]byte("$2a$10$3H9DLiHyPxJ29bMWRNyueOrGkbzJfE3BAR159ju3UetytAoKk7Ne2"), []byte(correctPassword))
assert.NoError(t, err)
err = bcrypt.CompareHashAndPassword([]byte("$2a$10$3H9DLiHyPxJ29bMWRNyueOrGkbzJfE3BAR159ju3UetytAoKk7Ne2"), []byte(wrongPassword))
assert.Error(t, err)
}
func TestBcryptCost(t *testing.T) {
correctPassword := "test_my_pass_new"
bytes, _ := bcrypt.GenerateFromPassword([]byte(correctPassword), bcrypt.DefaultCost)
err := bcrypt.CompareHashAndPassword(bytes, []byte(correctPassword))
assert.NoError(t, err)
bytes, _ = bcrypt.GenerateFromPassword([]byte(correctPassword), bcrypt.MinCost)
err = bcrypt.CompareHashAndPassword(bytes, []byte(correctPassword))
assert.NoError(t, err)
}