Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correctly validate root credentials from secret #2056

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions pkg/sidecar/sidecar.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,23 +151,23 @@ func NewSideCarController(kubeClient *kubernetes.Clientset, controllerClient *cl
}
data := newSecret.Data["config.env"]
// validate root creds in string
rootUserMissing := true
rootPassMissing := false
rootUserFound := false
rootPwdFound := false

dataStr := string(data)
if !strings.Contains(dataStr, "MINIO_ROOT_USER") {
rootUserMissing = true
if strings.Contains(dataStr, "MINIO_ROOT_USER") {
rootUserFound = true
}
if !strings.Contains(dataStr, "MINIO_ACCESS_KEY") {
rootUserMissing = true
if strings.Contains(dataStr, "MINIO_ACCESS_KEY") {
rootUserFound = true
}
if !strings.Contains(dataStr, "MINIO_ROOT_PASSWORD") {
rootPassMissing = true
if strings.Contains(dataStr, "MINIO_ROOT_PASSWORD") {
rootPwdFound = true
}
if !strings.Contains(dataStr, "MINIO_SECRET_KEY") {
rootPassMissing = true
if strings.Contains(dataStr, "MINIO_SECRET_KEY") {
rootPwdFound = true
}
if rootUserMissing || rootPassMissing {
if !rootUserFound || !rootPwdFound {
log.Println("Missing root credentials in the configuration.")
log.Println("MinIO won't start")
os.Exit(1)
Expand Down
Loading