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

Update GitHub Data Model to display admin-add events instead of UNKNOWN_ROLE #979

Merged
merged 1 commit into from
Nov 29, 2023

Conversation

egibs
Copy link
Contributor

@egibs egibs commented Nov 28, 2023

Background

GitHub's audit logs don't explicitly define an admin role and instead offers a few events that indicate admin permissions were assigned to a user (or at least when an attempt is made).

Originally, the data model only accounted for team.promote_maintainer, but there are two additional events that indicate admin permissions are being assigned or attempting to be assigned (at least at an organization level).

This PR adds the additional events and returns the event name rather than <UNKNOWN_ROLE> when these events are encountered. Worst case, the data model falls back to <UNKNOWN_ADMIN_ROLE> .

Changes

  • Adds additional admin events to the GitHub Data Model
  • Return the event name when possible

Testing

  • make fmt; make lint; make test
[PASS] Github - User Promoted
        [PASS] [rule] true
        [PASS] [title] GitHub.Audit: [cat] assigned admin privileges [team.promote_maintainer] to [bob]
        [PASS] [dedup] GitHub.Audit: [cat] assigned admin privileges [team.promote_maintainer] to [bob]
        [PASS] [alertContext] {"ips": [], "actor": "cat", "user": "bob"}
[PASS] Github - Admin Added
        [PASS] [rule] true
        [PASS] [title] GitHub.Audit: [cat] assigned admin privileges [business.add_admin] to [bob]
        [PASS] [dedup] GitHub.Audit: [cat] assigned admin privileges [business.add_admin] to [bob]
        [PASS] [alertContext] {"ips": [], "actor": "cat", "user": "bob"}
[PASS] Github - Admin Invited
        [PASS] [rule] true
        [PASS] [title] GitHub.Audit: [cat] assigned admin privileges [business.invite_admin] to [bob]
        [PASS] [dedup] GitHub.Audit: [cat] assigned admin privileges [business.invite_admin] to [bob]
        [PASS] [alertContext] {"ips": [], "actor": "cat", "user": "bob"}
[PASS] Github - Unknown Admin Role
        [PASS] [rule] false

@egibs egibs requested review from a team November 28, 2023 23:09
@egibs egibs enabled auto-merge (squash) November 28, 2023 23:12
Copy link
Contributor

@arielkr256 arielkr256 left a comment

Choose a reason for hiding this comment

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

Nice improvement!

@egibs egibs merged commit 0bd9fa8 into main Nov 29, 2023
1 check passed
@egibs egibs deleted the egibs-update-github-data-model branch November 29, 2023 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants