We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Missing `protocol` key for `aws_lb_listener`
**Describe the bug**
protocol is not a valid key for `aws_lb_listener`

**To Reproduce**
snippet
```hcl
resource "aws_lb_listener" "http_redirector" {
  load_balancer_arn = aws_lb.redirector.arn
  port              = "80"
  protocol          = "HTTP" #tfsec:ignore:AWS004
  default_action {
    type = "redirect"
    redirect {
      host        = "example.com"
      status_code = "HTTP_302"
    }
  }
}
```
Traceback
```
Traceback (most recent call last):
  File "/home/user/.config/pyenv/versions/checkov/bin/checkov", line 5, in <module>
    run()
  File "/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/main.py", line 65, in run
    files=file, guidelines=guidelines)
  File "/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/common/runners/runner_registry.py", line 31, in run
    runner_filter=self.runner_filter, collect_skip_comments=collect_skip_comments)
  File "/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/terraform/runner.py", line 61, in run
    self.check_tf_definition(report, root_folder, runner_filter, collect_skip_comments)
  File "/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/terraform/runner.py", line 90, in check_tf_definition
    scanned_file, runner_filter)
  File "/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/terraform/runner.py", line 98, in run_all_blocks
    scanned_file, block_type, runner_filter)
  File "/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/terraform/runner.py", line 136, in run_block
    results = registry.scan(scanned_file, entity, skipped_checks, runner_filter)
  File "/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/common/checks/base_check_registry.py", line 103, in scan
    result = self.run_check(check, entity_configuration, entity_name, entity_type, scanned_file, skip_info)
  File "/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/common/checks/base_check_registry.py", line 110, in run_check
    entity_name=entity_name, entity_type=entity_type, skip_info=skip_info)
  File "/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/common/checks/base_check.py", line 58, in run
    raise e
  File "/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/common/checks/base_check.py", line 39, in run
    check_result['result'] = self.scan_entity_conf(entity_configuration, entity_type)
  File "/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/terraform/checks/resource/base_resource_check.py", line 16, in scan_entity_conf
    return self.scan_resource_conf(conf, entity_type)
  File "/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/terraform/checks/resource/base_resource_check.py", line 28, in wrapper
    return wrapped(self, conf)
  File "/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/terraform/checks/resource/aws/ALBListenerHTTPS.py", line 29, in scan_resource_conf
    if default_action['redirect'][0]['protocol'] == ['HTTPS']:
KeyError: 'protocol'
```

**Expected behavior**
Test should pass

**Desktop (please complete the following information):**
 - Python: 3.7.9
 - Checkov Version 1.0.636

--- 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/ALBListenerHTTPS.py`
Content:
```
1 from checkov.common.models.enums import CheckResult, CheckCategories
2 from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
3 
4 class ALBListenerHTTPS(BaseResourceCheck):
5 
6     def __init__(self):
7         name = "Ensure ALB protocol is HTTPS"
8         id = "CKV_AWS_2"
9         supported_resources = ['aws_lb_listener']
10         categories = [CheckCategories.ENCRYPTION]
11         super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)
12 
13     def scan_resource_conf(self, conf):
14         """
15             validates kms rotation
16             https://www.terraform.io/docs/providers/aws/r/lb_listener.html
17         :param conf: aws_kms_key configuration
18         :return: <CheckResult>
19         """
20         key = 'protocol'
21         if key in conf.keys():
22             if conf[key] in (["HTTPS"], ["TLS"], ["TCP"], ["UDP"], ["TCP_UDP"]):
23                 return CheckResult.PASSED
24             elif conf[key] == ["HTTP"]:
25                 if 'default_action' in conf.keys():
26                     default_action = conf['default_action'][0]
27                     action_type = default_action['type']
28                     if action_type == ['redirect']:
29                         if default_action.get('redirect') and default_action['redirect'][0]['protocol'] == ['HTTPS']:
30                             return CheckResult.PASSED
31         return CheckResult.FAILED
32 
33 
34 check = ALBListenerHTTPS()
35
```

Path: `checkov/kubernetes/checks/Seccomp.py`
Content:
```
1 
2 from checkov.common.models.enums import CheckCategories, CheckResult
3 from checkov.kubernetes.base_spec_check import BaseK8Check
4 
5 
6 class Seccomp(BaseK8Check):
7 
8     def __init__(self):
9         # CIS-1.5 5.7.2
10         name = "Ensure that the seccomp profile is set to docker/default or runtime/default"
11         id = "CKV_K8S_31"
12         # Location: Pod.metadata.annotations.seccomp.security.alpha.kubernetes.io/pod
13         # Location: CronJob.spec.jobTemplate.spec.template.metadata.annotations.seccomp.security.alpha.kubernetes.io/pod
14         # Location: *.spec.template.metadata.annotations.seccomp.security.alpha.kubernetes.io/pod
15         supported_kind = ['Pod', 'Deployment', 'DaemonSet', 'StatefulSet', 'ReplicaSet', 'ReplicationController', 'Job', 'CronJob']
16         categories = [CheckCategories.KUBERNETES]
17         super().__init__(name=name, id=id, categories=categories, supported_entities=supported_kind)
18 
19     def get_resource_id(self, conf):
20         if "namespace" in conf["metadata"]:
21             return "{}.{}.{}".format(conf["kind"], conf["metadata"]["name"], conf["metadata"]["namespace"])
22         else:
23             return "{}.{}.default".format(conf["kind"], conf["metadata"]["name"])
24 
25     def scan_spec_conf(self, conf):
26         metadata = {}
27 
28         if conf['kind'] == 'Pod':
29             if "metadata" in conf:
30                 metadata = conf["metadata"]
31         elif conf['kind'] == 'CronJob':
32             if "spec" in conf:
33                 if "jobTemplate" in conf["spec"]:
34                     if "spec" in conf["spec"]["jobTemplate"]:
35                         if "template" in conf["spec"]["jobTemplate"]["spec"]:
36                             if "metadata" in conf["spec"]["jobTemplate"]["spec"]["template"]:
37                                 metadata = conf["spec"]["jobTemplate"]["spec"]["template"]["metadata"]
38         else:
39             if "spec" in conf:
40                 if "template" in conf["spec"]:
41                     if "metadata" in conf["spec"]["template"]:
42                         metadata = conf["spec"]["template"]["metadata"]
43 
44         if metadata:
45             if "annotations" in metadata and isinstance(metadata['annotations'], dict):
46                 if "seccomp.security.alpha.kubernetes.io/pod" in metadata["annotations"]:
47                     if ("docker/default" in metadata["annotations"]["seccomp.security.alpha.kubernetes.io/pod"] or
48                     "runtime/default" in metadata["annotations"]["seccomp.security.alpha.kubernetes.io/pod"]):
49                         return CheckResult.PASSED
50         return CheckResult.FAILED
51 
52 check = Seccomp()
53
```
--- 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/kubernetes/checks/Seccomp.py b/checkov/kubernetes/checks/Seccomp.py
--- a/checkov/kubernetes/checks/Seccomp.py
+++ b/checkov/kubernetes/checks/Seccomp.py
@@ -1,3 +1,4 @@
+import dpath
 
 from checkov.common.models.enums import CheckCategories, CheckResult
 from checkov.kubernetes.base_spec_check import BaseK8Check
@@ -12,6 +13,7 @@
         # Location: Pod.metadata.annotations.seccomp.security.alpha.kubernetes.io/pod
         # Location: CronJob.spec.jobTemplate.spec.template.metadata.annotations.seccomp.security.alpha.kubernetes.io/pod
         # Location: *.spec.template.metadata.annotations.seccomp.security.alpha.kubernetes.io/pod
+        # Location: *.spec.securityContext.seccompProfile.type
         supported_kind = ['Pod', 'Deployment', 'DaemonSet', 'StatefulSet', 'ReplicaSet', 'ReplicationController', 'Job', 'CronJob']
         categories = [CheckCategories.KUBERNETES]
         super().__init__(name=name, id=id, categories=categories, supported_entities=supported_kind)
@@ -26,6 +28,10 @@
         metadata = {}
 
         if conf['kind'] == 'Pod':
+            security_profile = dpath.search(conf, 'spec/securityContext/seccompProfile/type')
+            if security_profile:
+                security_profile = dpath.get(conf, 'spec/securityContext/seccompProfile/type')
+                return CheckResult.PASSED if security_profile == 'RuntimeDefault' else CheckResult.FAILED
             if "metadata" in conf:
                 metadata = conf["metadata"]
         elif conf['kind'] == 'CronJob':
@@ -45,8 +51,9 @@
             if "annotations" in metadata and isinstance(metadata['annotations'], dict):
                 if "seccomp.security.alpha.kubernetes.io/pod" in metadata["annotations"]:
                     if ("docker/default" in metadata["annotations"]["seccomp.security.alpha.kubernetes.io/pod"] or
-                    "runtime/default" in metadata["annotations"]["seccomp.security.alpha.kubernetes.io/pod"]):
+                            "runtime/default" in metadata["annotations"]["seccomp.security.alpha.kubernetes.io/pod"]):
                         return CheckResult.PASSED
         return CheckResult.FAILED
 
+
 check = Seccomp()
diff --git a/checkov/terraform/checks/resource/aws/ALBListenerHTTPS.py b/checkov/terraform/checks/resource/aws/ALBListenerHTTPS.py
--- a/checkov/terraform/checks/resource/aws/ALBListenerHTTPS.py
+++ b/checkov/terraform/checks/resource/aws/ALBListenerHTTPS.py
@@ -1,6 +1,7 @@
 from checkov.common.models.enums import CheckResult, CheckCategories
 from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
 
+
 class ALBListenerHTTPS(BaseResourceCheck):
 
     def __init__(self):
@@ -26,8 +27,12 @@
                     default_action = conf['default_action'][0]
                     action_type = default_action['type']
                     if action_type == ['redirect']:
-                        if default_action.get('redirect') and default_action['redirect'][0]['protocol'] == ['HTTPS']:
-                            return CheckResult.PASSED
+                        if default_action.get('redirect'):
+                            protocol = default_action['redirect'][0].get('protocol')
+                            if protocol == ['HTTPS']:
+                                return CheckResult.PASSED
+                            elif protocol is None:
+                                return CheckResult.UNKNOWN
         return CheckResult.FAILED

{"golden_diff": "diff --git a/checkov/kubernetes/checks/Seccomp.py b/checkov/kubernetes/checks/Seccomp.py\n--- a/checkov/kubernetes/checks/Seccomp.py\n+++ b/checkov/kubernetes/checks/Seccomp.py\n@@ -1,3 +1,4 @@\n+import dpath\n \n from checkov.common.models.enums import CheckCategories, CheckResult\n from checkov.kubernetes.base_spec_check import BaseK8Check\n@@ -12,6 +13,7 @@\n         # Location: Pod.metadata.annotations.seccomp.security.alpha.kubernetes.io/pod\n         # Location: CronJob.spec.jobTemplate.spec.template.metadata.annotations.seccomp.security.alpha.kubernetes.io/pod\n         # Location: *.spec.template.metadata.annotations.seccomp.security.alpha.kubernetes.io/pod\n+        # Location: *.spec.securityContext.seccompProfile.type\n         supported_kind = ['Pod', 'Deployment', 'DaemonSet', 'StatefulSet', 'ReplicaSet', 'ReplicationController', 'Job', 'CronJob']\n         categories = [CheckCategories.KUBERNETES]\n         super().__init__(name=name, id=id, categories=categories, supported_entities=supported_kind)\n@@ -26,6 +28,10 @@\n         metadata = {}\n \n         if conf['kind'] == 'Pod':\n+            security_profile = dpath.search(conf, 'spec/securityContext/seccompProfile/type')\n+            if security_profile:\n+                security_profile = dpath.get(conf, 'spec/securityContext/seccompProfile/type')\n+                return CheckResult.PASSED if security_profile == 'RuntimeDefault' else CheckResult.FAILED\n             if \"metadata\" in conf:\n                 metadata = conf[\"metadata\"]\n         elif conf['kind'] == 'CronJob':\n@@ -45,8 +51,9 @@\n             if \"annotations\" in metadata and isinstance(metadata['annotations'], dict):\n                 if \"seccomp.security.alpha.kubernetes.io/pod\" in metadata[\"annotations\"]:\n                     if (\"docker/default\" in metadata[\"annotations\"][\"seccomp.security.alpha.kubernetes.io/pod\"] or\n-                    \"runtime/default\" in metadata[\"annotations\"][\"seccomp.security.alpha.kubernetes.io/pod\"]):\n+                            \"runtime/default\" in metadata[\"annotations\"][\"seccomp.security.alpha.kubernetes.io/pod\"]):\n                         return CheckResult.PASSED\n         return CheckResult.FAILED\n \n+\n check = Seccomp()\ndiff --git a/checkov/terraform/checks/resource/aws/ALBListenerHTTPS.py b/checkov/terraform/checks/resource/aws/ALBListenerHTTPS.py\n--- a/checkov/terraform/checks/resource/aws/ALBListenerHTTPS.py\n+++ b/checkov/terraform/checks/resource/aws/ALBListenerHTTPS.py\n@@ -1,6 +1,7 @@\n from checkov.common.models.enums import CheckResult, CheckCategories\n from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck\n \n+\n class ALBListenerHTTPS(BaseResourceCheck):\n \n     def __init__(self):\n@@ -26,8 +27,12 @@\n                     default_action = conf['default_action'][0]\n                     action_type = default_action['type']\n                     if action_type == ['redirect']:\n-                        if default_action.get('redirect') and default_action['redirect'][0]['protocol'] == ['HTTPS']:\n-                            return CheckResult.PASSED\n+                        if default_action.get('redirect'):\n+                            protocol = default_action['redirect'][0].get('protocol')\n+                            if protocol == ['HTTPS']:\n+                                return CheckResult.PASSED\n+                            elif protocol is None:\n+                                return CheckResult.UNKNOWN\n         return CheckResult.FAILED\n", "issue": "Missing `protocol` key for `aws_lb_listener`\n**Describe the bug**\r\nprotocol is not a valid key for `aws_lb_listener`\r\n\r\n**To Reproduce**\r\nsnippet\r\n```hcl\r\nresource \"aws_lb_listener\" \"http_redirector\" {\r\n  load_balancer_arn = aws_lb.redirector.arn\r\n  port              = \"80\"\r\n  protocol          = \"HTTP\" #tfsec:ignore:AWS004\r\n  default_action {\r\n    type = \"redirect\"\r\n    redirect {\r\n      host        = \"example.com\"\r\n      status_code = \"HTTP_302\"\r\n    }\r\n  }\r\n}\r\n```\r\nTraceback\r\n```\r\nTraceback (most recent call last):\r\n  File \"/home/user/.config/pyenv/versions/checkov/bin/checkov\", line 5, in <module>\r\n    run()\r\n  File \"/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/main.py\", line 65, in run\r\n    files=file, guidelines=guidelines)\r\n  File \"/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/common/runners/runner_registry.py\", line 31, in run\r\n    runner_filter=self.runner_filter, collect_skip_comments=collect_skip_comments)\r\n  File \"/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/terraform/runner.py\", line 61, in run\r\n    self.check_tf_definition(report, root_folder, runner_filter, collect_skip_comments)\r\n  File \"/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/terraform/runner.py\", line 90, in check_tf_definition\r\n    scanned_file, runner_filter)\r\n  File \"/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/terraform/runner.py\", line 98, in run_all_blocks\r\n    scanned_file, block_type, runner_filter)\r\n  File \"/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/terraform/runner.py\", line 136, in run_block\r\n    results = registry.scan(scanned_file, entity, skipped_checks, runner_filter)\r\n  File \"/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/common/checks/base_check_registry.py\", line 103, in scan\r\n    result = self.run_check(check, entity_configuration, entity_name, entity_type, scanned_file, skip_info)\r\n  File \"/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/common/checks/base_check_registry.py\", line 110, in run_check\r\n    entity_name=entity_name, entity_type=entity_type, skip_info=skip_info)\r\n  File \"/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/common/checks/base_check.py\", line 58, in run\r\n    raise e\r\n  File \"/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/common/checks/base_check.py\", line 39, in run\r\n    check_result['result'] = self.scan_entity_conf(entity_configuration, entity_type)\r\n  File \"/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/terraform/checks/resource/base_resource_check.py\", line 16, in scan_entity_conf\r\n    return self.scan_resource_conf(conf, entity_type)\r\n  File \"/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/terraform/checks/resource/base_resource_check.py\", line 28, in wrapper\r\n    return wrapped(self, conf)\r\n  File \"/home/user/.config/pyenv/versions/3.7.9/envs/checkov/lib/python3.7/site-packages/checkov/terraform/checks/resource/aws/ALBListenerHTTPS.py\", line 29, in scan_resource_conf\r\n    if default_action['redirect'][0]['protocol'] == ['HTTPS']:\r\nKeyError: 'protocol'\r\n```\r\n\r\n**Expected behavior**\r\nTest should pass\r\n\r\n**Desktop (please complete the following information):**\r\n - Python: 3.7.9\r\n - Checkov Version 1.0.636\n", "before_files": [{"content": "from checkov.common.models.enums import CheckResult, CheckCategories\nfrom checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck\n\nclass ALBListenerHTTPS(BaseResourceCheck):\n\n    def __init__(self):\n        name = \"Ensure ALB protocol is HTTPS\"\n        id = \"CKV_AWS_2\"\n        supported_resources = ['aws_lb_listener']\n        categories = [CheckCategories.ENCRYPTION]\n        super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)\n\n    def scan_resource_conf(self, conf):\n        \"\"\"\n            validates kms rotation\n            https://www.terraform.io/docs/providers/aws/r/lb_listener.html\n        :param conf: aws_kms_key configuration\n        :return: <CheckResult>\n        \"\"\"\n        key = 'protocol'\n        if key in conf.keys():\n            if conf[key] in ([\"HTTPS\"], [\"TLS\"], [\"TCP\"], [\"UDP\"], [\"TCP_UDP\"]):\n                return CheckResult.PASSED\n            elif conf[key] == [\"HTTP\"]:\n                if 'default_action' in conf.keys():\n                    default_action = conf['default_action'][0]\n                    action_type = default_action['type']\n                    if action_type == ['redirect']:\n                        if default_action.get('redirect') and default_action['redirect'][0]['protocol'] == ['HTTPS']:\n                            return CheckResult.PASSED\n        return CheckResult.FAILED\n\n\ncheck = ALBListenerHTTPS()\n", "path": "checkov/terraform/checks/resource/aws/ALBListenerHTTPS.py"}, {"content": "\nfrom checkov.common.models.enums import CheckCategories, CheckResult\nfrom checkov.kubernetes.base_spec_check import BaseK8Check\n\n\nclass Seccomp(BaseK8Check):\n\n    def __init__(self):\n        # CIS-1.5 5.7.2\n        name = \"Ensure that the seccomp profile is set to docker/default or runtime/default\"\n        id = \"CKV_K8S_31\"\n        # Location: Pod.metadata.annotations.seccomp.security.alpha.kubernetes.io/pod\n        # Location: CronJob.spec.jobTemplate.spec.template.metadata.annotations.seccomp.security.alpha.kubernetes.io/pod\n        # Location: *.spec.template.metadata.annotations.seccomp.security.alpha.kubernetes.io/pod\n        supported_kind = ['Pod', 'Deployment', 'DaemonSet', 'StatefulSet', 'ReplicaSet', 'ReplicationController', 'Job', 'CronJob']\n        categories = [CheckCategories.KUBERNETES]\n        super().__init__(name=name, id=id, categories=categories, supported_entities=supported_kind)\n\n    def get_resource_id(self, conf):\n        if \"namespace\" in conf[\"metadata\"]:\n            return \"{}.{}.{}\".format(conf[\"kind\"], conf[\"metadata\"][\"name\"], conf[\"metadata\"][\"namespace\"])\n        else:\n            return \"{}.{}.default\".format(conf[\"kind\"], conf[\"metadata\"][\"name\"])\n\n    def scan_spec_conf(self, conf):\n        metadata = {}\n\n        if conf['kind'] == 'Pod':\n            if \"metadata\" in conf:\n                metadata = conf[\"metadata\"]\n        elif conf['kind'] == 'CronJob':\n            if \"spec\" in conf:\n                if \"jobTemplate\" in conf[\"spec\"]:\n                    if \"spec\" in conf[\"spec\"][\"jobTemplate\"]:\n                        if \"template\" in conf[\"spec\"][\"jobTemplate\"][\"spec\"]:\n                            if \"metadata\" in conf[\"spec\"][\"jobTemplate\"][\"spec\"][\"template\"]:\n                                metadata = conf[\"spec\"][\"jobTemplate\"][\"spec\"][\"template\"][\"metadata\"]\n        else:\n            if \"spec\" in conf:\n                if \"template\" in conf[\"spec\"]:\n                    if \"metadata\" in conf[\"spec\"][\"template\"]:\n                        metadata = conf[\"spec\"][\"template\"][\"metadata\"]\n\n        if metadata:\n            if \"annotations\" in metadata and isinstance(metadata['annotations'], dict):\n                if \"seccomp.security.alpha.kubernetes.io/pod\" in metadata[\"annotations\"]:\n                    if (\"docker/default\" in metadata[\"annotations\"][\"seccomp.security.alpha.kubernetes.io/pod\"] or\n                    \"runtime/default\" in metadata[\"annotations\"][\"seccomp.security.alpha.kubernetes.io/pod\"]):\n                        return CheckResult.PASSED\n        return CheckResult.FAILED\n\ncheck = Seccomp()\n", "path": "checkov/kubernetes/checks/Seccomp.py"}], "after_files": [{"content": "from checkov.common.models.enums import CheckResult, CheckCategories\nfrom checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck\n\n\nclass ALBListenerHTTPS(BaseResourceCheck):\n\n    def __init__(self):\n        name = \"Ensure ALB protocol is HTTPS\"\n        id = \"CKV_AWS_2\"\n        supported_resources = ['aws_lb_listener']\n        categories = [CheckCategories.ENCRYPTION]\n        super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)\n\n    def scan_resource_conf(self, conf):\n        \"\"\"\n            validates kms rotation\n            https://www.terraform.io/docs/providers/aws/r/lb_listener.html\n        :param conf: aws_kms_key configuration\n        :return: <CheckResult>\n        \"\"\"\n        key = 'protocol'\n        if key in conf.keys():\n            if conf[key] in ([\"HTTPS\"], [\"TLS\"], [\"TCP\"], [\"UDP\"], [\"TCP_UDP\"]):\n                return CheckResult.PASSED\n            elif conf[key] == [\"HTTP\"]:\n                if 'default_action' in conf.keys():\n                    default_action = conf['default_action'][0]\n                    action_type = default_action['type']\n                    if action_type == ['redirect']:\n                        if default_action.get('redirect'):\n                            protocol = default_action['redirect'][0].get('protocol')\n                            if protocol == ['HTTPS']:\n                                return CheckResult.PASSED\n                            elif protocol is None:\n                                return CheckResult.UNKNOWN\n        return CheckResult.FAILED\n\n\ncheck = ALBListenerHTTPS()\n", "path": "checkov/terraform/checks/resource/aws/ALBListenerHTTPS.py"}, {"content": "import dpath\n\nfrom checkov.common.models.enums import CheckCategories, CheckResult\nfrom checkov.kubernetes.base_spec_check import BaseK8Check\n\n\nclass Seccomp(BaseK8Check):\n\n    def __init__(self):\n        # CIS-1.5 5.7.2\n        name = \"Ensure that the seccomp profile is set to docker/default or runtime/default\"\n        id = \"CKV_K8S_31\"\n        # Location: Pod.metadata.annotations.seccomp.security.alpha.kubernetes.io/pod\n        # Location: CronJob.spec.jobTemplate.spec.template.metadata.annotations.seccomp.security.alpha.kubernetes.io/pod\n        # Location: *.spec.template.metadata.annotations.seccomp.security.alpha.kubernetes.io/pod\n        # Location: *.spec.securityContext.seccompProfile.type\n        supported_kind = ['Pod', 'Deployment', 'DaemonSet', 'StatefulSet', 'ReplicaSet', 'ReplicationController', 'Job', 'CronJob']\n        categories = [CheckCategories.KUBERNETES]\n        super().__init__(name=name, id=id, categories=categories, supported_entities=supported_kind)\n\n    def get_resource_id(self, conf):\n        if \"namespace\" in conf[\"metadata\"]:\n            return \"{}.{}.{}\".format(conf[\"kind\"], conf[\"metadata\"][\"name\"], conf[\"metadata\"][\"namespace\"])\n        else:\n            return \"{}.{}.default\".format(conf[\"kind\"], conf[\"metadata\"][\"name\"])\n\n    def scan_spec_conf(self, conf):\n        metadata = {}\n\n        if conf['kind'] == 'Pod':\n            security_profile = dpath.search(conf, 'spec/securityContext/seccompProfile/type')\n            if security_profile:\n                security_profile = dpath.get(conf, 'spec/securityContext/seccompProfile/type')\n                return CheckResult.PASSED if security_profile == 'RuntimeDefault' else CheckResult.FAILED\n            if \"metadata\" in conf:\n                metadata = conf[\"metadata\"]\n        elif conf['kind'] == 'CronJob':\n            if \"spec\" in conf:\n                if \"jobTemplate\" in conf[\"spec\"]:\n                    if \"spec\" in conf[\"spec\"][\"jobTemplate\"]:\n                        if \"template\" in conf[\"spec\"][\"jobTemplate\"][\"spec\"]:\n                            if \"metadata\" in conf[\"spec\"][\"jobTemplate\"][\"spec\"][\"template\"]:\n                                metadata = conf[\"spec\"][\"jobTemplate\"][\"spec\"][\"template\"][\"metadata\"]\n        else:\n            if \"spec\" in conf:\n                if \"template\" in conf[\"spec\"]:\n                    if \"metadata\" in conf[\"spec\"][\"template\"]:\n                        metadata = conf[\"spec\"][\"template\"][\"metadata\"]\n\n        if metadata:\n            if \"annotations\" in metadata and isinstance(metadata['annotations'], dict):\n                if \"seccomp.security.alpha.kubernetes.io/pod\" in metadata[\"annotations\"]:\n                    if (\"docker/default\" in metadata[\"annotations\"][\"seccomp.security.alpha.kubernetes.io/pod\"] or\n                            \"runtime/default\" in metadata[\"annotations\"][\"seccomp.security.alpha.kubernetes.io/pod\"]):\n                        return CheckResult.PASSED\n        return CheckResult.FAILED\n\n\ncheck = Seccomp()\n", "path": "checkov/kubernetes/checks/Seccomp.py"}]}