prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  [Bug]: False positives on some checks?
  ### Steps to Reproduce
  
  Hi,
  
  it looks like some checks produce false positives (they are tagged as warning because I've allowlisted them):
  
  ```
  Check ID: ec2_ebs_snapshots_encrypted - ec2 [medium]
          WARNING eu-central-1: EBS Snapshot snap-112 is unencrypted.
          WARNING eu-central-1: EBS Snapshot snap-113 is encrypted.  <<<<
  ```
  
  
  ```
  Check ID: iam_policy_allows_privilege_escalation - iam [high]
          WARNING eu-central-1: Custom Policy arn:aws:iam::112:policy/aws_admin_access does not allow privilege  escalation
  ```
  
  Are you maybe simply overring the status (also "PASS") by WARNING in case of an allowlist match?
  
  
  Another type of issue but more like a question:
  
  _sns_topics_not_publicly_accessible_ triggers with 
  ` WARNING eu-central-1: SNS topic cloudwatch-pagerduty-alarms-ec2-state-changes policy with public access but has a Condition`
  which is (from the User's perspective) a false positive as well because we have a condition, which prowler cannot evaluate?
  
  
  
  
  ### Expected behavior
  
  none
  
  ### Actual Result with Screenshots or Logs
  
  none
  
  ### How did you install Prowler?
  
  Cloning the repository from github.com (git clone)
  
  ### Environment Resource
  
  locally
  
  ### OS used
  
  Linux
  
  ### Prowler version
  
  3.4.1
  
  ### Pip version
  
  none
  
  ### Context
  
  _No response_
  
  </issue>
  <code>
  [start of prowler/providers/aws/services/sns/sns_topics_not_publicly_accessible/sns_topics_not_publicly_accessible.py]
  1 from prowler.lib.check.models import Check, Check_Report_AWS
  2 from prowler.providers.aws.services.sns.sns_client import sns_client
  3 
  4 
  5 class sns_topics_not_publicly_accessible(Check):
  6     def execute(self):
  7         findings = []
  8         for topic in sns_client.topics:
  9             report = Check_Report_AWS(self.metadata())
  10             report.region = topic.region
  11             report.resource_id = topic.name
  12             report.resource_arn = topic.arn
  13             report.resource_tags = topic.tags
  14             report.status = "PASS"
  15             report.status_extended = f"SNS topic {topic.name} without public access"
  16             if topic.policy:
  17                 for statement in topic.policy["Statement"]:
  18                     # Only check allow statements
  19                     if statement["Effect"] == "Allow":
  20                         if (
  21                             "*" in statement["Principal"]
  22                             or (
  23                                 "AWS" in statement["Principal"]
  24                                 and "*" in statement["Principal"]["AWS"]
  25                             )
  26                             or (
  27                                 "CanonicalUser" in statement["Principal"]
  28                                 and "*" in statement["Principal"]["CanonicalUser"]
  29                             )
  30                         ):
  31                             if "Condition" not in statement:
  32                                 report.status = "FAIL"
  33                                 report.status_extended = (
  34                                     f"SNS topic {topic.name} policy with public access"
  35                                 )
  36                             else:
  37                                 report.status = "FAIL"
  38                                 report.status_extended = f"SNS topic {topic.name} policy with public access but has a Condition"
  39 
  40             findings.append(report)
  41 
  42         return findings
  43
  [end of prowler/providers/aws/services/sns/sns_topics_not_publicly_accessible/sns_topics_not_publicly_accessible.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/prowler/providers/aws/services/sns/sns_topics_not_publicly_accessible/sns_topics_not_publicly_accessible.py b/prowler/providers/aws/services/sns/sns_topics_not_publicly_accessible/sns_topics_not_publicly_accessible.py
  --- a/prowler/providers/aws/services/sns/sns_topics_not_publicly_accessible/sns_topics_not_publicly_accessible.py
  +++ b/prowler/providers/aws/services/sns/sns_topics_not_publicly_accessible/sns_topics_not_publicly_accessible.py
  @@ -12,7 +12,7 @@
               report.resource_arn = topic.arn
               report.resource_tags = topic.tags
               report.status = "PASS"
  -            report.status_extended = f"SNS topic {topic.name} without public access"
  +            report.status_extended = f"SNS topic {topic.name} is not publicly accesible"
               if topic.policy:
                   for statement in topic.policy["Statement"]:
                       # Only check allow statements
  @@ -31,11 +31,11 @@
                               if "Condition" not in statement:
                                   report.status = "FAIL"
                                   report.status_extended = (
  -                                    f"SNS topic {topic.name} policy with public access"
  +                                    f"SNS topic {topic.name} is publicly accesible"
                                   )
                               else:
  -                                report.status = "FAIL"
  -                                report.status_extended = f"SNS topic {topic.name} policy with public access but has a Condition"
  +                                report.status = "PASS"
  +                                report.status_extended = f"SNS topic {topic.name} is publicly accesible but has a Condition that could filter it"
   
               findings.append(report)
  
verification_info: {"golden_diff": "diff --git a/prowler/providers/aws/services/sns/sns_topics_not_publicly_accessible/sns_topics_not_publicly_accessible.py b/prowler/providers/aws/services/sns/sns_topics_not_publicly_accessible/sns_topics_not_publicly_accessible.py\n--- a/prowler/providers/aws/services/sns/sns_topics_not_publicly_accessible/sns_topics_not_publicly_accessible.py\n+++ b/prowler/providers/aws/services/sns/sns_topics_not_publicly_accessible/sns_topics_not_publicly_accessible.py\n@@ -12,7 +12,7 @@\n             report.resource_arn = topic.arn\n             report.resource_tags = topic.tags\n             report.status = \"PASS\"\n-            report.status_extended = f\"SNS topic {topic.name} without public access\"\n+            report.status_extended = f\"SNS topic {topic.name} is not publicly accesible\"\n             if topic.policy:\n                 for statement in topic.policy[\"Statement\"]:\n                     # Only check allow statements\n@@ -31,11 +31,11 @@\n                             if \"Condition\" not in statement:\n                                 report.status = \"FAIL\"\n                                 report.status_extended = (\n-                                    f\"SNS topic {topic.name} policy with public access\"\n+                                    f\"SNS topic {topic.name} is publicly accesible\"\n                                 )\n                             else:\n-                                report.status = \"FAIL\"\n-                                report.status_extended = f\"SNS topic {topic.name} policy with public access but has a Condition\"\n+                                report.status = \"PASS\"\n+                                report.status_extended = f\"SNS topic {topic.name} is publicly accesible but has a Condition that could filter it\"\n \n             findings.append(report)\n", "issue": "[Bug]: False positives on some checks?\n### Steps to Reproduce\n\nHi,\r\n\r\nit looks like some checks produce false positives (they are tagged as warning because I've allowlisted them):\r\n\r\n```\r\nCheck ID: ec2_ebs_snapshots_encrypted - ec2 [medium]\r\n        WARNING eu-central-1: EBS Snapshot snap-112 is unencrypted.\r\n        WARNING eu-central-1: EBS Snapshot snap-113 is encrypted.  <<<<\r\n```\r\n\r\n\r\n```\r\nCheck ID: iam_policy_allows_privilege_escalation - iam [high]\r\n        WARNING eu-central-1: Custom Policy arn:aws:iam::112:policy/aws_admin_access does not allow privilege  escalation\r\n```\r\n\r\nAre you maybe simply overring the status (also \"PASS\") by WARNING in case of an allowlist match?\r\n\r\n\r\nAnother type of issue but more like a question:\r\n\r\n_sns_topics_not_publicly_accessible_ triggers with \r\n` WARNING eu-central-1: SNS topic cloudwatch-pagerduty-alarms-ec2-state-changes policy with public access but has a Condition`\r\nwhich is (from the User's perspective) a false positive as well because we have a condition, which prowler cannot evaluate?\r\n\r\n\r\n\n\n### Expected behavior\n\nnone\n\n### Actual Result with Screenshots or Logs\n\nnone\n\n### How did you install Prowler?\n\nCloning the repository from github.com (git clone)\n\n### Environment Resource\n\nlocally\n\n### OS used\n\nLinux\n\n### Prowler version\n\n3.4.1\n\n### Pip version\n\nnone\n\n### Context\n\n_No response_\n", "before_files": [{"content": "from prowler.lib.check.models import Check, Check_Report_AWS\nfrom prowler.providers.aws.services.sns.sns_client import sns_client\n\n\nclass sns_topics_not_publicly_accessible(Check):\n    def execute(self):\n        findings = []\n        for topic in sns_client.topics:\n            report = Check_Report_AWS(self.metadata())\n            report.region = topic.region\n            report.resource_id = topic.name\n            report.resource_arn = topic.arn\n            report.resource_tags = topic.tags\n            report.status = \"PASS\"\n            report.status_extended = f\"SNS topic {topic.name} without public access\"\n            if topic.policy:\n                for statement in topic.policy[\"Statement\"]:\n                    # Only check allow statements\n                    if statement[\"Effect\"] == \"Allow\":\n                        if (\n                            \"*\" in statement[\"Principal\"]\n                            or (\n                                \"AWS\" in statement[\"Principal\"]\n                                and \"*\" in statement[\"Principal\"][\"AWS\"]\n                            )\n                            or (\n                                \"CanonicalUser\" in statement[\"Principal\"]\n                                and \"*\" in statement[\"Principal\"][\"CanonicalUser\"]\n                            )\n                        ):\n                            if \"Condition\" not in statement:\n                                report.status = \"FAIL\"\n                                report.status_extended = (\n                                    f\"SNS topic {topic.name} policy with public access\"\n                                )\n                            else:\n                                report.status = \"FAIL\"\n                                report.status_extended = f\"SNS topic {topic.name} policy with public access but has a Condition\"\n\n            findings.append(report)\n\n        return findings\n", "path": "prowler/providers/aws/services/sns/sns_topics_not_publicly_accessible/sns_topics_not_publicly_accessible.py"}]}