-
Notifications
You must be signed in to change notification settings - Fork 176
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
THREAT-397 Reformat deep_get(event to event.deep_get( #1374
Merged
arielkr256
merged 5 commits into
release
from
THREAT-397-Reformat-deep_get(event-to-event.deep_get(
Oct 7, 2024
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1cbcd51
THREAT-397 Reformat deep_get(event to event.deep_get(
akozlovets098 272f36b
fixed global helper unit tests
ben-githubs 917e905
replace single-layer deep_get with get
ben-githubs ee484ed
THREAT-397 lint fix
akozlovets098 133ce36
Merge branch 'release' into THREAT-397-Reformat-deep_get(event-to-eve…
arielkr256 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,12 @@ | ||
from panther_base_helpers import deep_get | ||
|
||
|
||
def auth0_alert_context(event) -> dict: | ||
a_c = {} | ||
a_c["actor"] = deep_get( | ||
event, "data", "details", "request", "auth", "user", default="<NO_ACTOR_FOUND>" | ||
a_c["actor"] = event.deep_get( | ||
"data", "details", "request", "auth", "user", default="<NO_ACTOR_FOUND>" | ||
) | ||
a_c["action"] = deep_get(event, "data", "description", default="<NO_ACTION_FOUND>") | ||
a_c["action"] = event.deep_get("data", "description", default="<NO_ACTION_FOUND>") | ||
return a_c | ||
|
||
|
||
def is_auth0_config_event(event): | ||
channel = deep_get(event, "data", "details", "request", "channel", default="") | ||
channel = event.deep_get("data", "details", "request", "channel", default="") | ||
return channel == "https://manage.auth0.com/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,26 @@ | ||
from panther_base_helpers import deep_get | ||
|
||
|
||
def actor_user(event): | ||
category = deep_get(event, "category", default="") | ||
category = event.deep_get("category", default="") | ||
if category in {"ServicePrincipalSignInLogs"}: | ||
return deep_get(event, "properties", "servicePrincipalName") | ||
return event.deep_get("properties", "servicePrincipalName") | ||
if category in {"SignInLogs", "NonInteractiveUserSignInLogs"}: | ||
return deep_get(event, "properties", "userPrincipalName") | ||
return event.deep_get("properties", "userPrincipalName") | ||
return None | ||
|
||
|
||
def is_sign_in_event(event): | ||
return deep_get(event, "operationName", default="") == "Sign-in activity" | ||
return event.deep_get("operationName", default="") == "Sign-in activity" | ||
|
||
|
||
def azure_signin_alert_context(event) -> dict: | ||
ac_actor_user = actor_user(event) | ||
if ac_actor_user is None: | ||
ac_actor_user = "<NO_ACTORUSER>" | ||
a_c = {} | ||
a_c["tenantId"] = deep_get(event, "tenantId", default="<NO_TENANTID>") | ||
a_c["source_ip"] = deep_get(event, "properties", "ipAddress", default="<NO_SOURCEIP>") | ||
a_c["tenantId"] = event.deep_get("tenantId", default="<NO_TENANTID>") | ||
a_c["source_ip"] = event.deep_get("properties", "ipAddress", default="<NO_SOURCEIP>") | ||
a_c["actor_user"] = ac_actor_user | ||
a_c["resourceDisplayName"] = deep_get( | ||
event, "properties", "resourceDisplayName", default="<NO_RESOURCEDISPLAYNAME>" | ||
a_c["resourceDisplayName"] = event.deep_get( | ||
"properties", "resourceDisplayName", default="<NO_RESOURCEDISPLAYNAME>" | ||
) | ||
a_c["resourceId"] = deep_get(event, "properties", "resourceId", default="<NO_RESOURCEID>") | ||
a_c["resourceId"] = event.deep_get("properties", "resourceId", default="<NO_RESOURCEID>") | ||
return a_c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file was reformatted by black