Skip to content
Merged
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
5 changes: 3 additions & 2 deletions pkg/awsclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"os"
"regexp"
"strings"

"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
Expand Down Expand Up @@ -630,7 +631,7 @@ func NewSessionFromSecret(secret *corev1.Secret, region string) (*session.Sessio
return s, nil
}

var credentialProcessRE = regexp.MustCompile(`\bcredential_process\b`)
var credentialProcessRE = regexp.MustCompile(`(?i)\bcredential_process\b`)

func ContainsCredentialProcess(config []byte) bool {
return len(credentialProcessRE.Find(config)) != 0
Expand All @@ -648,7 +649,7 @@ func awsCLIConfigFromSecret(secret *corev1.Secret) ([]byte, error) {
buf := &bytes.Buffer{}
fmt.Fprint(buf, "[default]\n")
for k, v := range secret.Data {
if k == "credential_process" {
if strings.ToLower(k) == "credential_process" {
return nil, errors.New("credential_process is insecure and thus forbidden")
}
fmt.Fprintf(buf, "%s = %s\n", k, v)
Expand Down