mirror of
https://github.com/minio/minio.git
synced 2025-11-28 21:18:10 -05:00
config: Check for duplicated entries in all scopes (#3872)
Validate Minio config by checking if there is double json key in any scope level. The returned error contains the json path to the duplicated key.
This commit is contained in:
committed by
Harshavardhana
parent
cad0d0eb7a
commit
ae4361cc45
@@ -19,6 +19,7 @@ package cmd
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"os"
|
||||
|
||||
"github.com/minio/mc/pkg/console"
|
||||
@@ -75,6 +76,16 @@ type credential struct {
|
||||
secretKeyHash []byte
|
||||
}
|
||||
|
||||
func (c *credential) Validate() error {
|
||||
if !isAccessKeyValid(c.AccessKey) {
|
||||
return errors.New("Invalid access key")
|
||||
}
|
||||
if !isSecretKeyValid(c.SecretKey) {
|
||||
return errors.New("Invalid secret key")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Generate a bcrypt hashed key for input secret key.
|
||||
func mustGetHashedSecretKey(secretKey string) []byte {
|
||||
hashedSecretKey, err := bcrypt.GenerateFromPassword([]byte(secretKey), bcrypt.DefaultCost)
|
||||
|
||||
Reference in New Issue
Block a user