Find, verify, and analyze leaked credentials
Go credentialsdevsecopsdynamic-analysisprecommitscanningsecretsecret-managementsecretssecuritysecurity-toolstrufflehogverification
validate if twitter services are more than one before accessing it. (#3565)
Abdul Basitd073ad69caa0
diff --git a/pkg/analyzer/analyzers/twilio/twilio.go b/pkg/analyzer/analyzers/twilio/twilio.goindex 33a49cb14..e09eb9c50 100644--- a/pkg/analyzer/analyzers/twilio/twilio.go+++ b/pkg/analyzer/analyzers/twilio/twilio.go@@ -83,13 +83,20 @@ func (a *Analyzer) Analyze(ctx context.Context, credentialInfo map[string]string}}- var bindings []analyzers.Binding- parentAccountSID := info.ServicesRes.Services[0].AccountSID- parentAccountFriendlyName := info.ServicesRes.Services[0].FriendlyName+ var (+ bindings []analyzers.Binding+ parentAccountSID = ""+ parentAccountFriendlyName = ""+ )++ if len(info.ServicesRes.Services) > 0 {+ parentAccountSID = info.ServicesRes.Services[0].AccountSID+ parentAccountFriendlyName = info.ServicesRes.Services[0].FriendlyName+ }for _, account := range accounts {accountType := "Account"- if account.SID != parentAccountSID {+ if parentAccountSID != "" && account.SID != parentAccountSID {accountType = "SubAccount"}resource := analyzers.Resource{@@ -97,7 +104,7 @@ func (a *Analyzer) Analyze(ctx context.Context, credentialInfo map[string]stringFullyQualifiedName: "twilio.com/account/" + account.SID,Type: accountType,}- if account.SID != parentAccountSID {+ if parentAccountSID != "" && account.SID != parentAccountSID {resource.Parent = &analyzers.Resource{Name: parentAccountFriendlyName,FullyQualifiedName: "twilio.com/account/" + parentAccountSID,