We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
CKV_AWS_300 S3 MPU lifecycle alert
**Issue**
Alert ID - CKV_AWS_300 
Checkov sends false alert for MPU "aws_s3_bucket_lifecycle_configuration" despite having the correct rule configuration. In my scenario I'm having an empty filter in my terraform code. But as per logic in checkov code base, (checkov/checkov/terraform/checks/resource/aws/S3AbortIncompleteUploads.py) under scan_resource_conf method, the 'if' condition doesn't take the 'filter' condition into account. This in-turn throws a false alert.

**Examples**
```hcl
resource "aws_s3_bucket_lifecycle_configuration" "lifecycle_rule" {
  bucket = aws_s3_bucket.s3.id
  rule {
    abort_incomplete_multipart_upload {
      days_after_initiation = 3
    }
    id = "MPU 3days"
    filter {
    }
    status = "Enabled"
  }
}
```

**Version (please complete the following information):**
 - Checkov 2.3.155 (Latest)



--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `checkov/terraform/checks/resource/aws/S3AbortIncompleteUploads.py`
Content:
```
1 from __future__ import annotations
2 
3 from typing import Any
4 
5 from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
6 from checkov.common.models.enums import CheckCategories, CheckResult
7 
8 
9 class S3AbortIncompleteUploads(BaseResourceCheck):
10     def __init__(self) -> None:
11         """
12         If you don't set this value in a lifecycle configuration you'll end up paying for s3
13         resources you never could use
14         """
15         name = "Ensure S3 lifecycle configuration sets period for aborting failed uploads"
16         id = "CKV_AWS_300"
17         supported_resources = ("aws_s3_bucket_lifecycle_configuration",)
18         categories = (CheckCategories.GENERAL_SECURITY,)
19         super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)
20 
21     def scan_resource_conf(self, conf: dict[str, list[Any]]) -> CheckResult:
22         self.evaluated_keys = ["rule"]
23         rules = conf.get("rule")
24         if rules and isinstance(rules, list):
25             for idx_rule, rule in enumerate(rules):
26                 if (
27                     rule.get("abort_incomplete_multipart_upload")
28                     and rule.get("status") == ["Enabled"]
29                     and not rule.get("filter")
30                 ):
31                     self.evaluated_keys = [f"rule/[{idx_rule}]/abort_incomplete_multipart_upload"]
32                     return CheckResult.PASSED
33 
34         return CheckResult.FAILED
35 
36 
37 check = S3AbortIncompleteUploads()
38
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/checkov/terraform/checks/resource/aws/S3AbortIncompleteUploads.py b/checkov/terraform/checks/resource/aws/S3AbortIncompleteUploads.py
--- a/checkov/terraform/checks/resource/aws/S3AbortIncompleteUploads.py
+++ b/checkov/terraform/checks/resource/aws/S3AbortIncompleteUploads.py
@@ -23,12 +23,13 @@
         rules = conf.get("rule")
         if rules and isinstance(rules, list):
             for idx_rule, rule in enumerate(rules):
-                if (
-                    rule.get("abort_incomplete_multipart_upload")
-                    and rule.get("status") == ["Enabled"]
-                    and not rule.get("filter")
-                ):
+                if rule.get("abort_incomplete_multipart_upload") and rule.get("status") == ["Enabled"]:
                     self.evaluated_keys = [f"rule/[{idx_rule}]/abort_incomplete_multipart_upload"]
+                    filter = rule.get("filter")
+                    if filter and isinstance(filter, list) and filter[0]:
+                        # it is possible to set an empty filter, which applies then to all objects
+                        continue
+
                     return CheckResult.PASSED
 
         return CheckResult.FAILED

{"golden_diff": "diff --git a/checkov/terraform/checks/resource/aws/S3AbortIncompleteUploads.py b/checkov/terraform/checks/resource/aws/S3AbortIncompleteUploads.py\n--- a/checkov/terraform/checks/resource/aws/S3AbortIncompleteUploads.py\n+++ b/checkov/terraform/checks/resource/aws/S3AbortIncompleteUploads.py\n@@ -23,12 +23,13 @@\n         rules = conf.get(\"rule\")\n         if rules and isinstance(rules, list):\n             for idx_rule, rule in enumerate(rules):\n-                if (\n-                    rule.get(\"abort_incomplete_multipart_upload\")\n-                    and rule.get(\"status\") == [\"Enabled\"]\n-                    and not rule.get(\"filter\")\n-                ):\n+                if rule.get(\"abort_incomplete_multipart_upload\") and rule.get(\"status\") == [\"Enabled\"]:\n                     self.evaluated_keys = [f\"rule/[{idx_rule}]/abort_incomplete_multipart_upload\"]\n+                    filter = rule.get(\"filter\")\n+                    if filter and isinstance(filter, list) and filter[0]:\n+                        # it is possible to set an empty filter, which applies then to all objects\n+                        continue\n+\n                     return CheckResult.PASSED\n \n         return CheckResult.FAILED\n", "issue": "CKV_AWS_300 S3 MPU lifecycle alert\n**Issue**\r\nAlert ID - CKV_AWS_300 \r\nCheckov sends false alert for MPU \"aws_s3_bucket_lifecycle_configuration\" despite having the correct rule configuration. In my scenario I'm having an empty filter in my terraform code. But as per logic in checkov code base, (checkov/checkov/terraform/checks/resource/aws/S3AbortIncompleteUploads.py) under scan_resource_conf method, the 'if' condition doesn't take the 'filter' condition into account. This in-turn throws a false alert.\r\n\r\n**Examples**\r\n```hcl\r\nresource \"aws_s3_bucket_lifecycle_configuration\" \"lifecycle_rule\" {\r\n  bucket = aws_s3_bucket.s3.id\r\n  rule {\r\n    abort_incomplete_multipart_upload {\r\n      days_after_initiation = 3\r\n    }\r\n    id = \"MPU 3days\"\r\n    filter {\r\n    }\r\n    status = \"Enabled\"\r\n  }\r\n}\r\n```\r\n\r\n**Version (please complete the following information):**\r\n - Checkov 2.3.155 (Latest)\r\n\r\n\n", "before_files": [{"content": "from __future__ import annotations\n\nfrom typing import Any\n\nfrom checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck\nfrom checkov.common.models.enums import CheckCategories, CheckResult\n\n\nclass S3AbortIncompleteUploads(BaseResourceCheck):\n    def __init__(self) -> None:\n        \"\"\"\n        If you don't set this value in a lifecycle configuration you'll end up paying for s3\n        resources you never could use\n        \"\"\"\n        name = \"Ensure S3 lifecycle configuration sets period for aborting failed uploads\"\n        id = \"CKV_AWS_300\"\n        supported_resources = (\"aws_s3_bucket_lifecycle_configuration\",)\n        categories = (CheckCategories.GENERAL_SECURITY,)\n        super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)\n\n    def scan_resource_conf(self, conf: dict[str, list[Any]]) -> CheckResult:\n        self.evaluated_keys = [\"rule\"]\n        rules = conf.get(\"rule\")\n        if rules and isinstance(rules, list):\n            for idx_rule, rule in enumerate(rules):\n                if (\n                    rule.get(\"abort_incomplete_multipart_upload\")\n                    and rule.get(\"status\") == [\"Enabled\"]\n                    and not rule.get(\"filter\")\n                ):\n                    self.evaluated_keys = [f\"rule/[{idx_rule}]/abort_incomplete_multipart_upload\"]\n                    return CheckResult.PASSED\n\n        return CheckResult.FAILED\n\n\ncheck = S3AbortIncompleteUploads()\n", "path": "checkov/terraform/checks/resource/aws/S3AbortIncompleteUploads.py"}], "after_files": [{"content": "from __future__ import annotations\n\nfrom typing import Any\n\nfrom checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck\nfrom checkov.common.models.enums import CheckCategories, CheckResult\n\n\nclass S3AbortIncompleteUploads(BaseResourceCheck):\n    def __init__(self) -> None:\n        \"\"\"\n        If you don't set this value in a lifecycle configuration you'll end up paying for s3\n        resources you never could use\n        \"\"\"\n        name = \"Ensure S3 lifecycle configuration sets period for aborting failed uploads\"\n        id = \"CKV_AWS_300\"\n        supported_resources = (\"aws_s3_bucket_lifecycle_configuration\",)\n        categories = (CheckCategories.GENERAL_SECURITY,)\n        super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)\n\n    def scan_resource_conf(self, conf: dict[str, list[Any]]) -> CheckResult:\n        self.evaluated_keys = [\"rule\"]\n        rules = conf.get(\"rule\")\n        if rules and isinstance(rules, list):\n            for idx_rule, rule in enumerate(rules):\n                if rule.get(\"abort_incomplete_multipart_upload\") and rule.get(\"status\") == [\"Enabled\"]:\n                    self.evaluated_keys = [f\"rule/[{idx_rule}]/abort_incomplete_multipart_upload\"]\n                    filter = rule.get(\"filter\")\n                    if filter and isinstance(filter, list) and filter[0]:\n                        # it is possible to set an empty filter, which applies then to all objects\n                        continue\n\n                    return CheckResult.PASSED\n\n        return CheckResult.FAILED\n\n\ncheck = S3AbortIncompleteUploads()\n", "path": "checkov/terraform/checks/resource/aws/S3AbortIncompleteUploads.py"}]}