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

[Asset Inventory][Azure] Add Acitive Directory fetcher to fetch Service Principals #2625

Merged
merged 30 commits into from
Nov 13, 2024

Conversation

kubasobon
Copy link
Member

@kubasobon kubasobon commented Oct 18, 2024

Summary of your changes

This PR adds an Active Directory fetcher and fetchers Azure Service Principals. It utilizes microsoftgraph/msgraph-sdk-go, since this Active Directory API is not exposed in the SDK we've been using so far. This is the recommended approach.

Screenshot/Data

Screenshot 2024-10-18 at 15 24 41

Related Issues

Closes https://github.com/elastic/security-team/issues/10161

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary README/documentation (if appropriate)

@kubasobon kubasobon self-assigned this Oct 18, 2024
Copy link

mergify bot commented Oct 18, 2024

This pull request does not have a backport label. Could you fix it @kubasobon? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 8./d branch. /d is the digit
    NOTE: backport-v8.x has been added to help with the transition to the new branch 8.x.

@kubasobon kubasobon marked this pull request as ready for review October 18, 2024 13:26
@kubasobon kubasobon requested a review from a team as a code owner October 18, 2024 13:26
Copy link

mergify bot commented Nov 4, 2024

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b ast-inv-azure-principals upstream/ast-inv-azure-principals
git merge upstream/main
git push upstream ast-inv-azure-principals

Copy link

mergify bot commented Nov 4, 2024

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b ast-inv-azure-principals upstream/ast-inv-azure-principals
git merge upstream/main
git push upstream ast-inv-azure-principals

Copy link

mergify bot commented Nov 5, 2024

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b ast-inv-azure-principals upstream/ast-inv-azure-principals
git merge upstream/main
git push upstream ast-inv-azure-principals

return true // to continue the iteration
})
if err != nil {
p.log.Errorf("error iterating over Service Principals: %v", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we return the error if principals are not returned?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a log, because we might still get some resources. The pagination failed, but items slice has been populated. We try to get the best scenario for us - getting data, even if incomplete.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. It's just that we don't check if there was indeed any item or not. But also I don't have a good argument to bring the error up if the items is empty and error exist. In practice an error will be logged anyway

@kubasobon
Copy link
Member Author

@romulets Please take another look

@kubasobon kubasobon enabled auto-merge (squash) November 13, 2024 09:29
@kubasobon kubasobon merged commit d849030 into elastic:main Nov 13, 2024
11 checks passed
@kubasobon kubasobon deleted the ast-inv-azure-principals branch November 13, 2024 09:45
mergify bot pushed a commit that referenced this pull request Nov 13, 2024
…ce Principals (#2625)

(cherry picked from commit d849030)

# Conflicts:
#	go.sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants