mirror of
https://github.com/minio/minio.git
synced 2025-05-22 01:53:55 -04:00
fix: validate secret key before updating service accounts
This commit is contained in:
parent
b8833c2947
commit
f4623ea8dc
20
cmd/iam.go
20
cmd/iam.go
@ -1203,6 +1203,10 @@ func (sys *IAMSys) UpdateServiceAccount(ctx context.Context, accessKey string, o
|
|||||||
return errNoSuchServiceAccount
|
return errNoSuchServiceAccount
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !auth.IsSecretKeyValid(opts.secretKey) {
|
||||||
|
return auth.ErrInvalidSecretKeyLength
|
||||||
|
}
|
||||||
|
|
||||||
if opts.secretKey != "" {
|
if opts.secretKey != "" {
|
||||||
cr.SecretKey = opts.secretKey
|
cr.SecretKey = opts.secretKey
|
||||||
}
|
}
|
||||||
@ -1346,6 +1350,14 @@ func (sys *IAMSys) CreateUser(accessKey string, uinfo madmin.UserInfo) error {
|
|||||||
return errIAMActionNotAllowed
|
return errIAMActionNotAllowed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !auth.IsAccessKeyValid(accessKey) {
|
||||||
|
return auth.ErrInvalidAccessKeyLength
|
||||||
|
}
|
||||||
|
|
||||||
|
if !auth.IsSecretKeyValid(uinfo.SecretKey) {
|
||||||
|
return auth.ErrInvalidSecretKeyLength
|
||||||
|
}
|
||||||
|
|
||||||
sys.store.lock()
|
sys.store.lock()
|
||||||
defer sys.store.unlock()
|
defer sys.store.unlock()
|
||||||
|
|
||||||
@ -1388,6 +1400,14 @@ func (sys *IAMSys) SetUserSecretKey(accessKey string, secretKey string) error {
|
|||||||
return errIAMActionNotAllowed
|
return errIAMActionNotAllowed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !auth.IsAccessKeyValid(accessKey) {
|
||||||
|
return auth.ErrInvalidAccessKeyLength
|
||||||
|
}
|
||||||
|
|
||||||
|
if !auth.IsSecretKeyValid(secretKey) {
|
||||||
|
return auth.ErrInvalidSecretKeyLength
|
||||||
|
}
|
||||||
|
|
||||||
sys.store.lock()
|
sys.store.lock()
|
||||||
defer sys.store.unlock()
|
defer sys.store.unlock()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user