Skip to content

Commit

Permalink
dynamic severity
Browse files Browse the repository at this point in the history
  • Loading branch information
arielkr256 committed Dec 4, 2024
1 parent b1059e2 commit 24780ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions rules/aws_eks_rules/anonymous_api_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@


def rule(event):
if event.deep_get("annotations", "authorization.k8s.io/decision") != "allow":
return False
src_ip = event.get("sourceIPs", ["0.0.0.0"]) # nosec
if src_ip == ["127.0.0.1"]:
return False
Expand All @@ -25,6 +23,14 @@ def title(event):
)


def severity(event):
if event.deep_get("annotations", "authorization.k8s.io/decision") != "allow":
return "INFO"
if event.get("requestURI") == "/version":
return "INFO"
return "DEFAULT"


def dedup(event):
p_eks = eks_panther_obj_ref(event)
return f"anonymous_access_{p_eks.get('p_source_label')}_{event.get('userAgent')}"
Expand Down
2 changes: 1 addition & 1 deletion rules/aws_eks_rules/anonymous_api_access.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ Tests:
"verb": "get"
}
- Name: Anonymous API Access Web Scanner Denied
ExpectedResult: false
ExpectedResult: true
Log:
{
"annotations": {
Expand Down

0 comments on commit 24780ef

Please sign in to comment.