Skip to content

Commit

Permalink
Google provider: limit to 10 pages of groups requests
Browse files Browse the repository at this point in the history
  • Loading branch information
ploxiln committed Nov 26, 2018
1 parent 3b85ef2 commit f6a736e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion providers/google.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ func getAdminService(adminEmail string, credentialsReader io.Reader) *admin.Serv

func userInGroup(service *admin.Service, groups []string, email string) bool {
pageToken := ""
for {
// limit to 10 pages/requests
for i := 0; i < 10; i++ {
req := service.Groups.List().UserKey(email)
if pageToken != "" {
req.PageToken(pageToken)
Expand All @@ -204,6 +205,8 @@ func userInGroup(service *admin.Service, groups []string, email string) bool {
}
pageToken = resp.NextPageToken
}
log.Printf("WARNING: %s has more than 10 pages of groups", email)
return false
}

// ValidateGroup validates that the provided email exists in the configured Google
Expand Down

0 comments on commit f6a736e

Please sign in to comment.