-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: update MongoDB RuleIDs to convention, prefer deep_get over dict.…
…get (#836) * fix: update MongoDB RuleIDs to convention, prefer deep_get over dict.get
- Loading branch information
Ed
authored
Jun 26, 2023
1 parent
f6c0f52
commit 389cbf9
Showing
6 changed files
with
32 additions
and
26 deletions.
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from panther_base_helpers import deep_get, deep_walk | ||
|
||
|
||
def rule(event): | ||
return deep_get(event, "eventTypeName", default="") == "API_KEY_ACCESS_LIST_ENTRY_ADDED" | ||
|
||
|
||
def title(event): | ||
user = deep_get(event, "username", default="<USER_NOT_FOUND>") | ||
public_key = deep_get(event, "targetPublicKey", default="<PUBLIC_KEY_NOT_FOUND>") | ||
return f"MongoDB Atlas: [{user}] updated the allowed access list for API Key [{public_key}]" | ||
|
||
|
||
def alert_context(event): | ||
links = deep_walk(event, "links", "href", return_val="first", default="<LINKS_NOT_FOUND>") | ||
return { | ||
"links": links, | ||
"username": deep_get(event, "username", default="<USER_NOT_FOUND>"), | ||
"event_type_name": deep_get(event, "eventTypeName", default="<EVENT_TYPE_NOT_FOUND>"), | ||
"org_id": deep_get(event, "orgId", default="<ORG_ID_NOT_FOUND>"), | ||
"target_public_key": deep_get(event, "targetPublicKey", default="<PUBLIC_KEY_NOT_FOUND>"), | ||
} |
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