Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add --select flag suport to list group-members #84

Merged
merged 8 commits into from
Aug 28, 2024
Merged

Conversation

mistahj67
Copy link
Contributor

@mistahj67 mistahj67 commented Aug 27, 2024

Description

Part 2 of BED-4586
Closes #69
Closes #64

Adds --select as a flag for the list group-members command

Defaults the $select param to the following if the flag is not present:

  • odata.type
  • id
  • displayName
  • createdDateTime

Ensure an escape hatch for --select="" in order to return Azure default entity properties
Support custom --select properties as a comma delimited list as well ex: --select="id,assignedPlans,email"

Cleaned up some duplicate logic as well

Motivation and Context

Decrease file size by defaulting to a property list that will keep file sizes low but ensure there's still an ability to pull any / all properties for group members.

This should address concerns from #69
This was inspired by the efforts of @malac and PR #64

How Has This Been Tested?

Ran locally in azurehound directory after go build

  • ./azurehound list group-members --json -o path/to/output.json --select=""
    • Should show full output
  • ./azurehound list group-members --json -o path/to/output.json
    • Should show the above default properties
  • ./azurehound list group-members --json -o path/to/output.json --select="id,assignedPlans,email"
    • Should show the id, assignedPlans, email (and odata.type b/c that's required)

Also ingested into Bloodhound Enterprise and verified no apparent errors with analysis.

Updated unit tests

Types of changes

  • Chore (a change that does not modify the application functionality)
  • Is a breaking as default group members output will be limited to the default above
  • Refactor

Checklist:

  • I have met the contributing prerequisites
    • Assigned myself to this PR
    • Added the appropriate labels
  • I have followed proper test practices
    • Added/updated tests to cover my changes
    • All new and existing tests passed

@mistahj67 mistahj67 added the enhancement New feature or request label Aug 27, 2024
@mistahj67 mistahj67 self-assigned this Aug 27, 2024
client/rest/client.go Outdated Show resolved Hide resolved
client/rest/client.go Outdated Show resolved Hide resolved
client/rest/client.go Outdated Show resolved Hide resolved
client/rest/client.go Outdated Show resolved Hide resolved
client/rest/client.go Outdated Show resolved Hide resolved
client/rest/client.go Outdated Show resolved Hide resolved
cmd/list-app-owners.go Show resolved Hide resolved
client/client.go Show resolved Hide resolved
@mistahj67 mistahj67 marked this pull request as ready for review August 28, 2024 18:40
@mistahj67 mistahj67 requested a review from ddlees August 28, 2024 18:40
@mistahj67 mistahj67 merged commit 46e9bca into main Aug 28, 2024
9 checks passed
@mistahj67 mistahj67 deleted the BED-4586-pt-2 branch August 28, 2024 20:06
@github-actions github-actions bot locked and limited conversation to collaborators Aug 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redundant and exsessive data in JSON output file when using "group-members" flag
2 participants