prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  ecr_repositories_scan_vulnerabilities_in_latest_image: Configure level
  ### New feature motivation
  
  Hi, is it possible to configure the level from which the test shall fail?
  AWS tags some findings as medium which I might want to ignore, but of course I don't want to mute critical findings for the image.
  
  ### Solution Proposed
  
  none
  
  ### Describe alternatives you've considered
  
  none
  
  ### Additional context
  
  _No response_
  
  </issue>
  <code>
  [start of prowler/providers/aws/services/ecr/ecr_repositories_scan_vulnerabilities_in_latest_image/ecr_repositories_scan_vulnerabilities_in_latest_image.py]
  1 from prowler.lib.check.models import Check, Check_Report_AWS
  2 from prowler.providers.aws.services.ecr.ecr_client import ecr_client
  3 
  4 
  5 class ecr_repositories_scan_vulnerabilities_in_latest_image(Check):
  6     def execute(self):
  7         findings = []
  8         for registry in ecr_client.registries.values():
  9             for repository in registry.repositories:
  10                 # First check if the repository has images
  11                 if len(repository.images_details) > 0:
  12                     # We only want to check the latest image pushed
  13                     image = repository.images_details[-1]
  14 
  15                     report = Check_Report_AWS(self.metadata())
  16                     report.region = repository.region
  17                     report.resource_id = repository.name
  18                     report.resource_arn = repository.arn
  19                     report.resource_tags = repository.tags
  20                     report.status = "PASS"
  21                     report.status_extended = f"ECR repository {repository.name} has imageTag {image.latest_tag} scanned without findings."
  22                     if not image.scan_findings_status:
  23                         report.status = "FAIL"
  24                         report.status_extended = f"ECR repository {repository.name} has imageTag {image.latest_tag} without a scan."
  25                     elif image.scan_findings_status == "FAILED":
  26                         report.status = "FAIL"
  27                         report.status_extended = (
  28                             f"ECR repository {repository.name} with scan status FAILED."
  29                         )
  30                     elif image.scan_findings_status != "FAILED":
  31                         if image.scan_findings_severity_count and (
  32                             image.scan_findings_severity_count.critical
  33                             or image.scan_findings_severity_count.high
  34                             or image.scan_findings_severity_count.medium
  35                         ):
  36                             report.status = "FAIL"
  37                             report.status_extended = f"ECR repository {repository.name} has imageTag {image.latest_tag} scanned with findings: CRITICAL->{image.scan_findings_severity_count.critical}, HIGH->{image.scan_findings_severity_count.high}, MEDIUM->{image.scan_findings_severity_count.medium}."
  38 
  39                     findings.append(report)
  40 
  41         return findings
  42
  [end of prowler/providers/aws/services/ecr/ecr_repositories_scan_vulnerabilities_in_latest_image/ecr_repositories_scan_vulnerabilities_in_latest_image.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/ecr/ecr_repositories_scan_vulnerabilities_in_latest_image/ecr_repositories_scan_vulnerabilities_in_latest_image.py b/prowler/providers/aws/services/ecr/ecr_repositories_scan_vulnerabilities_in_latest_image/ecr_repositories_scan_vulnerabilities_in_latest_image.py
  --- a/prowler/providers/aws/services/ecr/ecr_repositories_scan_vulnerabilities_in_latest_image/ecr_repositories_scan_vulnerabilities_in_latest_image.py
  +++ b/prowler/providers/aws/services/ecr/ecr_repositories_scan_vulnerabilities_in_latest_image/ecr_repositories_scan_vulnerabilities_in_latest_image.py
  @@ -5,6 +5,12 @@
   class ecr_repositories_scan_vulnerabilities_in_latest_image(Check):
       def execute(self):
           findings = []
  +
  +        # Get minimun severity to report
  +        minimum_severity = ecr_client.audit_config.get(
  +            "ecr_repository_vulnerability_minimum_severity", "MEDIUM"
  +        )
  +
           for registry in ecr_client.registries.values():
               for repository in registry.repositories:
                   # First check if the repository has images
  @@ -27,8 +33,23 @@
                           report.status_extended = (
                               f"ECR repository {repository.name} with scan status FAILED."
                           )
  -                    elif image.scan_findings_status != "FAILED":
  -                        if image.scan_findings_severity_count and (
  +                    elif (
  +                        image.scan_findings_status != "FAILED"
  +                        and image.scan_findings_severity_count
  +                    ):
  +                        if (
  +                            minimum_severity == "CRITICAL"
  +                            and image.scan_findings_severity_count.critical
  +                        ):
  +                            report.status = "FAIL"
  +                            report.status_extended = f"ECR repository {repository.name} has imageTag {image.latest_tag} scanned with findings: CRITICAL->{image.scan_findings_severity_count.critical}."
  +                        elif minimum_severity == "HIGH" and (
  +                            image.scan_findings_severity_count.critical
  +                            or image.scan_findings_severity_count.high
  +                        ):
  +                            report.status = "FAIL"
  +                            report.status_extended = f"ECR repository {repository.name} has imageTag {image.latest_tag} scanned with findings: CRITICAL->{image.scan_findings_severity_count.critical}, HIGH->{image.scan_findings_severity_count.high}."
  +                        elif minimum_severity == "MEDIUM" and (
                               image.scan_findings_severity_count.critical
                               or image.scan_findings_severity_count.high
                               or image.scan_findings_severity_count.medium
  
verification_info: {"golden_diff": "diff --git a/prowler/providers/aws/services/ecr/ecr_repositories_scan_vulnerabilities_in_latest_image/ecr_repositories_scan_vulnerabilities_in_latest_image.py b/prowler/providers/aws/services/ecr/ecr_repositories_scan_vulnerabilities_in_latest_image/ecr_repositories_scan_vulnerabilities_in_latest_image.py\n--- a/prowler/providers/aws/services/ecr/ecr_repositories_scan_vulnerabilities_in_latest_image/ecr_repositories_scan_vulnerabilities_in_latest_image.py\n+++ b/prowler/providers/aws/services/ecr/ecr_repositories_scan_vulnerabilities_in_latest_image/ecr_repositories_scan_vulnerabilities_in_latest_image.py\n@@ -5,6 +5,12 @@\n class ecr_repositories_scan_vulnerabilities_in_latest_image(Check):\n     def execute(self):\n         findings = []\n+\n+        # Get minimun severity to report\n+        minimum_severity = ecr_client.audit_config.get(\n+            \"ecr_repository_vulnerability_minimum_severity\", \"MEDIUM\"\n+        )\n+\n         for registry in ecr_client.registries.values():\n             for repository in registry.repositories:\n                 # First check if the repository has images\n@@ -27,8 +33,23 @@\n                         report.status_extended = (\n                             f\"ECR repository {repository.name} with scan status FAILED.\"\n                         )\n-                    elif image.scan_findings_status != \"FAILED\":\n-                        if image.scan_findings_severity_count and (\n+                    elif (\n+                        image.scan_findings_status != \"FAILED\"\n+                        and image.scan_findings_severity_count\n+                    ):\n+                        if (\n+                            minimum_severity == \"CRITICAL\"\n+                            and image.scan_findings_severity_count.critical\n+                        ):\n+                            report.status = \"FAIL\"\n+                            report.status_extended = f\"ECR repository {repository.name} has imageTag {image.latest_tag} scanned with findings: CRITICAL->{image.scan_findings_severity_count.critical}.\"\n+                        elif minimum_severity == \"HIGH\" and (\n+                            image.scan_findings_severity_count.critical\n+                            or image.scan_findings_severity_count.high\n+                        ):\n+                            report.status = \"FAIL\"\n+                            report.status_extended = f\"ECR repository {repository.name} has imageTag {image.latest_tag} scanned with findings: CRITICAL->{image.scan_findings_severity_count.critical}, HIGH->{image.scan_findings_severity_count.high}.\"\n+                        elif minimum_severity == \"MEDIUM\" and (\n                             image.scan_findings_severity_count.critical\n                             or image.scan_findings_severity_count.high\n                             or image.scan_findings_severity_count.medium\n", "issue": "ecr_repositories_scan_vulnerabilities_in_latest_image: Configure level\n### New feature motivation\n\nHi, is it possible to configure the level from which the test shall fail?\r\nAWS tags some findings as medium which I might want to ignore, but of course I don't want to mute critical findings for the image.\n\n### Solution Proposed\n\nnone\n\n### Describe alternatives you've considered\n\nnone\n\n### Additional context\n\n_No response_\n", "before_files": [{"content": "from prowler.lib.check.models import Check, Check_Report_AWS\nfrom prowler.providers.aws.services.ecr.ecr_client import ecr_client\n\n\nclass ecr_repositories_scan_vulnerabilities_in_latest_image(Check):\n    def execute(self):\n        findings = []\n        for registry in ecr_client.registries.values():\n            for repository in registry.repositories:\n                # First check if the repository has images\n                if len(repository.images_details) > 0:\n                    # We only want to check the latest image pushed\n                    image = repository.images_details[-1]\n\n                    report = Check_Report_AWS(self.metadata())\n                    report.region = repository.region\n                    report.resource_id = repository.name\n                    report.resource_arn = repository.arn\n                    report.resource_tags = repository.tags\n                    report.status = \"PASS\"\n                    report.status_extended = f\"ECR repository {repository.name} has imageTag {image.latest_tag} scanned without findings.\"\n                    if not image.scan_findings_status:\n                        report.status = \"FAIL\"\n                        report.status_extended = f\"ECR repository {repository.name} has imageTag {image.latest_tag} without a scan.\"\n                    elif image.scan_findings_status == \"FAILED\":\n                        report.status = \"FAIL\"\n                        report.status_extended = (\n                            f\"ECR repository {repository.name} with scan status FAILED.\"\n                        )\n                    elif image.scan_findings_status != \"FAILED\":\n                        if image.scan_findings_severity_count and (\n                            image.scan_findings_severity_count.critical\n                            or image.scan_findings_severity_count.high\n                            or image.scan_findings_severity_count.medium\n                        ):\n                            report.status = \"FAIL\"\n                            report.status_extended = f\"ECR repository {repository.name} has imageTag {image.latest_tag} scanned with findings: CRITICAL->{image.scan_findings_severity_count.critical}, HIGH->{image.scan_findings_severity_count.high}, MEDIUM->{image.scan_findings_severity_count.medium}.\"\n\n                    findings.append(report)\n\n        return findings\n", "path": "prowler/providers/aws/services/ecr/ecr_repositories_scan_vulnerabilities_in_latest_image/ecr_repositories_scan_vulnerabilities_in_latest_image.py"}]}