Skip to content

Commit

Permalink
limit information collected by "azurehound list group-members" to onl…
Browse files Browse the repository at this point in the history
…y collect member IDs
  • Loading branch information
malacupa committed Nov 16, 2023
1 parent faeb09f commit de04953
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions client/groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ func (s *azureClient) GetAzureADGroupOwners(ctx context.Context, objectId string
}
}

func (s *azureClient) GetAzureADGroupMembers(ctx context.Context, objectId string, filter string, search string, count bool) (azure.MemberObjectList, error) {
func (s *azureClient) GetAzureADGroupMembers(ctx context.Context, objectId string, filter string, search string, count bool, selectCols []string) (azure.MemberObjectList, error) {
var (
path = fmt.Sprintf("/%s/groups/%s/members", constants.GraphApiBetaVersion, objectId)
params = query.Params{Filter: filter, Search: search, Count: count}.AsMap()
params = query.Params{Filter: filter, Search: search, Count: count, Select: selectCols}.AsMap()
response azure.MemberObjectList
)
if res, err := s.msgraph.Get(ctx, path, params, nil); err != nil {
Expand Down Expand Up @@ -246,7 +246,7 @@ func (s *azureClient) ListAzureADGroupMembers(ctx context.Context, objectId stri
nextLink string
)

if list, err := s.GetAzureADGroupMembers(ctx, objectId, filter, search, false); err != nil {
if list, err := s.GetAzureADGroupMembers(ctx, objectId, filter, search, false, selectCols); err != nil {
errResult.Error = err
if ok := pipeline.Send(ctx.Done(), out, errResult); !ok {
return
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-group-members.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func listGroupMembers(ctx context.Context, client client.AzureClient, groups <-c
}
count = 0
)
for item := range client.ListAzureADGroupMembers(ctx, id, "", "", "", nil) {
for item := range client.ListAzureADGroupMembers(ctx, id, "", "", "", []string{"id"}) {
if item.Error != nil {
log.Error(item.Error, "unable to continue processing members for this group", "groupId", id)
} else {
Expand Down

0 comments on commit de04953

Please sign in to comment.