Skip to content

Commit

Permalink
Merge pull request #7 from DataDog/no-fail-on-missing-k8s-permissions…
Browse files Browse the repository at this point in the history
…-find-secrets

find-secrets: Don't fail and only show a warning in case of missing permissions
  • Loading branch information
christophetd authored Jun 1, 2023
2 parents 8b3b4d7 + 8b4e847 commit dd01a81
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,27 @@ func (m *SecretsDetector) FindSecrets() ([]*SecretInfo, error) {

log.Println("Searching for AWS secrets in ConfigMaps...")
configMapCredentials, err := m.findCredentialsInConfigMaps()
if err != nil {
return nil, err
if err == nil {
secrets = append(secrets, configMapCredentials...)
} else {
log.Println("[WARN] Unable to access ConfigMaps: " + err.Error())
}
secrets = append(secrets, configMapCredentials...)

log.Println("Searching for AWS secrets in Secrets...")
secretCredentials, err := m.findCredentialsInSecrets()
if err != nil {
return nil, err
if err == nil {
secrets = append(secrets, secretCredentials...)
} else {
log.Println("[WARN] Unable to access Secrets: " + err.Error())
}
secrets = append(secrets, secretCredentials...)

log.Println("Searching for AWS secrets in Pod definitions...")
podCredentials, err := m.findCredentialsInPodDefinitions()
if err != nil {
return nil, err
if err == nil {
secrets = append(secrets, podCredentials...)
} else {
log.Println("[WARN] Unable to access Pod definitions: " + err.Error())
}
secrets = append(secrets, podCredentials...)

return secrets, nil
}
Expand Down

0 comments on commit dd01a81

Please sign in to comment.