Skip to content

Commit

Permalink
Refactor panther_azuresignin_helpers.actor_user to use imported `de…
Browse files Browse the repository at this point in the history
…ep_get` (#1422)

Co-authored-by: Ariel Ropek <[email protected]>
  • Loading branch information
ben-githubs and arielkr256 authored Nov 12, 2024
1 parent 4a79a46 commit ac1ad37
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions global_helpers/panther_azuresignin_helpers.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
from panther_base_helpers import deep_get


def actor_user(event):
# 'event' could be a PantherEvent or an ImmutableCaseInsensitiveDict, so we have to use the
# imported deep_get method.
category = event.get("category", "")
if category in {"ServicePrincipalSignInLogs"}:
return event.deep_get("properties", "servicePrincipalName")
return deep_get(event, "properties", "servicePrincipalName")
if category in {"SignInLogs", "NonInteractiveUserSignInLogs"}:
return event.deep_get("properties", "userPrincipalName")
return deep_get(event, "properties", "userPrincipalName")
return None


Expand Down

0 comments on commit ac1ad37

Please sign in to comment.