mirror of
https://github.com/trufflesecurity/trufflehog.git
synced 2024-11-14 17:07:31 +00:00
validate if twitter services are more than one before accessing it. (#3565)
This commit is contained in:
parent
944d5dcdc2
commit
d073ad69ca
1 changed files with 12 additions and 5 deletions
|
@ -83,13 +83,20 @@ func (a *Analyzer) Analyze(ctx context.Context, credentialInfo map[string]string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var bindings []analyzers.Binding
|
var (
|
||||||
parentAccountSID := info.ServicesRes.Services[0].AccountSID
|
bindings []analyzers.Binding
|
||||||
parentAccountFriendlyName := info.ServicesRes.Services[0].FriendlyName
|
parentAccountSID = ""
|
||||||
|
parentAccountFriendlyName = ""
|
||||||
|
)
|
||||||
|
|
||||||
|
if len(info.ServicesRes.Services) > 0 {
|
||||||
|
parentAccountSID = info.ServicesRes.Services[0].AccountSID
|
||||||
|
parentAccountFriendlyName = info.ServicesRes.Services[0].FriendlyName
|
||||||
|
}
|
||||||
|
|
||||||
for _, account := range accounts {
|
for _, account := range accounts {
|
||||||
accountType := "Account"
|
accountType := "Account"
|
||||||
if account.SID != parentAccountSID {
|
if parentAccountSID != "" && account.SID != parentAccountSID {
|
||||||
accountType = "SubAccount"
|
accountType = "SubAccount"
|
||||||
}
|
}
|
||||||
resource := analyzers.Resource{
|
resource := analyzers.Resource{
|
||||||
|
@ -97,7 +104,7 @@ func (a *Analyzer) Analyze(ctx context.Context, credentialInfo map[string]string
|
||||||
FullyQualifiedName: "twilio.com/account/" + account.SID,
|
FullyQualifiedName: "twilio.com/account/" + account.SID,
|
||||||
Type: accountType,
|
Type: accountType,
|
||||||
}
|
}
|
||||||
if account.SID != parentAccountSID {
|
if parentAccountSID != "" && account.SID != parentAccountSID {
|
||||||
resource.Parent = &analyzers.Resource{
|
resource.Parent = &analyzers.Resource{
|
||||||
Name: parentAccountFriendlyName,
|
Name: parentAccountFriendlyName,
|
||||||
FullyQualifiedName: "twilio.com/account/" + parentAccountSID,
|
FullyQualifiedName: "twilio.com/account/" + parentAccountSID,
|
||||||
|
|
Loading…
Reference in a new issue