Repository: bridgecrewio/checkov

Issue:
YAML: Skip comment crashes checkov
**Describe the issue**
Checkov crashes while examining a skip rule when linting a Gitlab-CI file.

```sh
  File "/usr/local/lib/python3.11/site-packages/checkov/yaml_doc/base_registry.py", line 59, in <listcomp>
    skip_info = ([skip for skip in skip_infos if item[STARTLINE_MARK] <= skip["line_number"] <= item[ENDLINE_MARK]] or [{}])[0]
                                                 ~~~~^^^^^^^^^^^^^^^^
TypeError: list indices must be integers or slices, not str
```

**Examples**

Create the following file in an empty directory:

_.gitlab-ci.yml_
```yaml
foo:
  # checkov:skip=CKV_GITLABCI_2:False positive. Does not create double pipelines.
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
      when: never
    - if: $CI_PIPELINE_SOURCE != "merge_request_event" && $CI_PIPELINE_SOURCE != "schedule"
      when: manual
      allow_failure: true

```

Affected code line:
https://github.com/bridgecrewio/checkov/blob/2162cb3696b7b35e024001a9a55e6e38a79f841f/checkov/yaml_doc/base_registry.py#L59C34-L59C34

**Exception Trace**
Please share the trace for the exception and all relevant output by checkov.
To maximize the understanding, please run checkov with LOG_LEVEL set to debug
as follows:
```sh
root@94028c03dcac:/code/aaa# LOG_LEVEL=DEBUG checkov -d .
2023-07-20 09:36:42,886 [MainThread  ] [DEBUG]  Leveraging the bundled IAM Definition.
2023-07-20 09:36:42,887 [MainThread  ] [DEBUG]  Leveraging the IAM definition at /usr/local/lib/python3.11/site-packages/policy_sentry/shared/data/iam-definition.json
2023-07-20 09:36:43,608 [MainThread  ] [DEBUG]  Adding the IntegrationFeatureRegistry <checkov.common.bridgecrew.integration_features.features.policy_metadata_integration.PolicyMetadataIntegration object at 0x7f15008f7250> with order 0
2023-07-20 09:36:43,608 [MainThread  ] [DEBUG]  self.features after the sort:
2023-07-20 09:36:43,608 [MainThread  ] [DEBUG]  [<checkov.common.bridgecrew.integration_features.features.policy_metadata_integration.PolicyMetadataIntegration object at 0x7f15008f7250>]
2023-07-20 09:36:43,609 [MainThread  ] [DEBUG]  Adding the IntegrationFeatureRegistry <checkov.common.bridgecrew.integration_features.features.suppressions_integration.SuppressionsIntegration object at 0x7f15008f7210> with order 2
2023-07-20 09:36:43,609 [MainThread  ] [DEBUG]  self.features after the sort:
2023-07-20 09:36:43,609 [MainThread  ] [DEBUG]  [<checkov.common.bridgecrew.integration_features.features.policy_metadata_integration.PolicyMetadataIntegration object at 0x7f15008f7250>, <checkov.common.bridgecrew.integration_features.features.suppressions_integration.SuppressionsIntegration object at 0x7f15008f7210>]
2023-07-20 09:36:43,612 [MainThread  ] [DEBUG]  Adding the IntegrationFeatureRegistry <checkov.common.bridgecrew.integration_features.features.policies_3d_integration.Policies3DIntegration object at 0x7f14ff583e50> with order 11
2023-07-20 09:36:43,612 [MainThread  ] [DEBUG]  self.features after the sort:
2023-07-20 09:36:43,613 [MainThread  ] [DEBUG]  [<checkov.common.bridgecrew.integration_features.features.policy_metadata_integration.PolicyMetadataIntegration object at 0x7f15008f7250>, <checkov.common.bridgecrew.integration_features.features.suppressions_integration.SuppressionsIntegration object at 0x7f15008f7210>, <checkov.common.bridgecrew.integration_features.features.policies_3d_integration.Policies3DIntegration object at 0x7f14ff583e50>]
2023-07-20 09:36:43,613 [MainThread  ] [DEBUG]  Adding the IntegrationFeatureRegistry <checkov.common.bridgecrew.integration_features.features.repo_config_integration.RepoConfigIntegration object at 0x7f14ff5b0d90> with order 0
2023-07-20 09:36:43,613 [MainThread  ] [DEBUG]  self.features after the sort:
2023-07-20 09:36:43,613 [MainThread  ] [DEBUG]  [<checkov.common.bridgecrew.integration_features.features.policy_metadata_integration.PolicyMetadataIntegration object at 0x7f15008f7250>, <checkov.common.bridgecrew.integration_features.features.repo_config_integration.RepoConfigIntegration object at 0x7f14ff5b0d90>, <checkov.common.bridgecrew.integration_features.features.suppressions_integration.SuppressionsIntegration object at 0x7f15008f7210>, <checkov.common.bridgecrew.integration_features.features.policies_3d_integration.Policies3DIntegration object at 0x7f14ff583e50>]
2023-07-20 09:36:43,614 [MainThread  ] [DEBUG]  Adding the IntegrationFeatureRegistry <checkov.common.bridgecrew.integration_features.features.fixes_integration.FixesIntegration object at 0x7f14ff5b1850> with order 10
2023-07-20 09:36:43,614 [MainThread  ] [DEBUG]  self.features after the sort:
2023-07-20 09:36:43,614 [MainThread  ] [DEBUG]  [<checkov.common.bridgecrew.integration_features.features.policy_metadata_integration.PolicyMetadataIntegration object at 0x7f15008f7250>, <checkov.common.bridgecrew.integration_features.features.repo_config_integration.RepoConfigIntegration object at 0x7f14ff5b0d90>, <checkov.common.bridgecrew.integration_features.features.suppressions_integration.SuppressionsIntegration object at 0x7f15008f7210>, <checkov.common.bridgecrew.integration_features.features.fixes_integration.FixesIntegration object at 0x7f14ff5b1850>, <checkov.common.bridgecrew.integration_features.features.policies_3d_integration.Policies3DIntegration object at 0x7f14ff583e50>]
2023-07-20 09:36:43,615 [MainThread  ] [DEBUG]  Adding the IntegrationFeatureRegistry <checkov.common.bridgecrew.integration_features.features.licensing_integration.LicensingIntegration object at 0x7f14ff5b2ad0> with order 6
2023-07-20 09:36:43,615 [MainThread  ] [DEBUG]  self.features after the sort:
2023-07-20 09:36:43,615 [MainThread  ] [DEBUG]  [<checkov.common.bridgecrew.integration_features.features.policy_metadata_integration.PolicyMetadataIntegration object at 0x7f15008f7250>, <checkov.common.bridgecrew.integration_features.features.repo_config_integration.RepoConfigIntegration object at 0x7f14ff5b0d90>, <checkov.common.bridgecrew.integration_features.features.suppressions_integration.SuppressionsIntegration object at 0x7f15008f7210>, <checkov.common.bridgecrew.integration_features.features.licensing_integration.LicensingIntegration object at 0x7f14ff5b2ad0>, <checkov.common.bridgecrew.integration_features.features.fixes_integration.FixesIntegration object at 0x7f14ff5b1850>, <checkov.common.bridgecrew.integration_features.features.policies_3d_integration.Policies3DIntegration object at 0x7f14ff583e50>]
2023-07-20 09:36:43,616 [MainThread  ] [DEBUG]  Adding the IntegrationFeatureRegistry <checkov.common.bridgecrew.integration_features.features.custom_policies_integration.CustomPoliciesIntegration object at 0x7f14ff5b3250> with order 1
2023-07-20 09:36:43,616 [MainThread  ] [DEBUG]  self.features after the sort:
2023-07-20 09:36:43,616 [MainThread  ] [DEBUG]  [<checkov.common.bridgecrew.integration_features.features.policy_metadata_integration.PolicyMetadataIntegration object at 0x7f15008f7250>, <checkov.common.bridgecrew.integration_features.features.repo_config_integration.RepoConfigIntegration object at 0x7f14ff5b0d90>, <checkov.common.bridgecrew.integration_features.features.custom_policies_integration.CustomPoliciesIntegration object at 0x7f14ff5b3250>, <checkov.common.bridgecrew.integration_features.features.suppressions_integration.SuppressionsIntegration object at 0x7f15008f7210>, <checkov.common.bridgecrew.integration_features.features.licensing_integration.LicensingIntegration object at 0x7f14ff5b2ad0>, <checkov.common.bridgecrew.integration_features.features.fixes_integration.FixesIntegration object at 0x7f14ff5b1850>, <checkov.common.bridgecrew.integration_features.features.policies_3d_integration.Policies3DIntegration object at 0x7f14ff583e50>]
2023-07-20 09:36:43,712 [MainThread  ] [DEBUG]  Loading external checks from /usr/local/lib/python3.11/site-packages/checkov/bicep/checks/graph_checks
2023-07-20 09:36:43,712 [MainThread  ] [DEBUG]  Searching through ['__pycache__'] and ['SQLServerAuditingEnabled.json', '__init__.py']
2023-07-20 09:36:43,714 [MainThread  ] [DEBUG]  Searching through [] and ['__init__.cpython-311.pyc']
2023-07-20 09:36:43,880 [MainThread  ] [DEBUG]  Popen(['git', 'version'], cwd=/code/aaa, universal_newlines=False, shell=None, istream=None)
2023-07-20 09:36:43,881 [MainThread  ] [DEBUG]  Popen(['git', 'version'], cwd=/code/aaa, universal_newlines=False, shell=None, istream=None)
2023-07-20 09:36:44,123 [MainThread  ] [DEBUG]  No API key present; setting include_all_checkov_policies to True
2023-07-20 09:36:44,125 [MainThread  ] [DEBUG]  Run metadata: {
  "checkov_version": "2.3.335",
  "python_executable": "/usr/local/bin/python3",
  "python_version": "3.11.4 (main, Jul  4 2023, 05:51:40) [GCC 10.2.1 20210110]",
  "checkov_executable": "/usr/local/bin/checkov",
  "args": [
    "Command Line Args:   -d .",
    "Defaults:",
    "  --framework:       ['all']",
    "  --branch:          master",
    "  --download-external-modules:False",
    "  --external-modules-download-path:.external_modules",
    "  --evaluate-variables:True",
    "  --secrets-scan-file-type:[]",
    "  --block-list-secret-scan:[]",
    "  --summary-position:top",
    "  --mask:            []",
    "  --secrets-history-timeout:12h",
    ""
  ],
  "OS_system_info": "Linux-5.15.112-microsoft-standard-WSL2-x86_64-with-glibc2.31",
  "CPU_architecture": "",
  "Python_implementation": "CPython"
}
2023-07-20 09:36:44,125 [MainThread  ] [DEBUG]  Using cert_reqs None
2023-07-20 09:36:44,125 [MainThread  ] [DEBUG]  Successfully set up HTTP manager
2023-07-20 09:36:44,125 [MainThread  ] [DEBUG]  Resultant set of frameworks (removing skipped frameworks): all
2023-07-20 09:36:44,125 [MainThread  ] [DEBUG]  BC_SOURCE = cli, version = 2.3.335
2023-07-20 09:36:44,125 [MainThread  ] [DEBUG]  terraform_runner declares no system dependency checks required.
2023-07-20 09:36:44,126 [MainThread  ] [DEBUG]  cloudformation_runner declares no system dependency checks required.
2023-07-20 09:36:44,126 [MainThread  ] [DEBUG]  kubernetes_runner declares no system dependency checks required.
2023-07-20 09:36:44,126 [MainThread  ] [DEBUG]  serverless_runner declares no system dependency checks required.
2023-07-20 09:36:44,126 [MainThread  ] [DEBUG]  arm_runner declares no system dependency checks required.
2023-07-20 09:36:44,126 [MainThread  ] [DEBUG]  terraform_plan_runner declares no system dependency checks required.
2023-07-20 09:36:44,126 [MainThread  ] [INFO ]  Checking necessary system dependancies for helm checks.
2023-07-20 09:36:44,127 [MainThread  ] [INFO ]  Error running necessary tools to process helm checks.
2023-07-20 09:36:44,127 [MainThread  ] [DEBUG]  dockerfile_runner declares no system dependency checks required.
2023-07-20 09:36:44,127 [MainThread  ] [DEBUG]  secrets_runner declares no system dependency checks required.
2023-07-20 09:36:44,127 [MainThread  ] [DEBUG]  json_runner declares no system dependency checks required.
2023-07-20 09:36:44,127 [MainThread  ] [DEBUG]  yaml_runner declares no system dependency checks required.
2023-07-20 09:36:44,127 [MainThread  ] [DEBUG]  github_configuration_runner declares no system dependency checks required.
2023-07-20 09:36:44,127 [MainThread  ] [DEBUG]  gitlab_configuration_runner declares no system dependency checks required.
2023-07-20 09:36:44,127 [MainThread  ] [DEBUG]  gitlab_ci_runner declares no system dependency checks required.
2023-07-20 09:36:44,127 [MainThread  ] [DEBUG]  bitbucket_configuration_runner declares no system dependency checks required.
2023-07-20 09:36:44,127 [MainThread  ] [DEBUG]  bitbucket_pipelines_runner declares no system dependency checks required.
2023-07-20 09:36:44,127 [MainThread  ] [INFO ]  Checking necessary system dependancies for kustomize checks.
2023-07-20 09:36:44,128 [MainThread  ] [INFO ]  Could not find usable tools locally to process kustomize checks. Framework will be disabled for this run.
2023-07-20 09:36:44,128 [MainThread  ] [DEBUG]  github_actions_runner declares no system dependency checks required.
2023-07-20 09:36:44,128 [MainThread  ] [DEBUG]  bicep_runner declares no system dependency checks required.
2023-07-20 09:36:44,128 [MainThread  ] [DEBUG]  openapi_runner declares no system dependency checks required.
2023-07-20 09:36:44,128 [MainThread  ] [DEBUG]  sca_image_runner declares no system dependency checks required.
2023-07-20 09:36:44,128 [MainThread  ] [DEBUG]  argo_workflows_runner declares no system dependency checks required.
2023-07-20 09:36:44,128 [MainThread  ] [DEBUG]  circleci_pipelines_runner declares no system dependency checks required.
2023-07-20 09:36:44,128 [MainThread  ] [DEBUG]  azure_pipelines_runner declares no system dependency checks required.
2023-07-20 09:36:44,128 [MainThread  ] [DEBUG]  ansible_runner declares no system dependency checks required.
2023-07-20 09:36:44,128 [MainThread  ] [DEBUG]  terraform_json_runner declares no system dependency checks required.
2023-07-20 09:36:44,128 [MainThread  ] [DEBUG]  sca_package_runner declares no system dependency checks required....
2023-07-20 09:36:45,548 [MainThread  ] [DEBUG]  skip_severity = None, explicit_skip = [], regex_match = False, suppressed_policies: []
2023-07-20 09:36:45,548 [MainThread  ] [DEBUG]  should_run_check CKV2_GHA_1: True
2023-07-20 09:36:45,548 [MainThread  ] [DEBUG]  bc_check_id = BC_REPO_GITLAB_CI_3, include_all_checkov_policies = True, is_external = False, explicit_run: []
2023-07-20 09:36:45,548 [MainThread  ] [DEBUG]  should_run_check CKV_GITLABCI_3: True
2023-07-20 09:36:45,543 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_31
2023-07-20 09:36:45,548 [MainThread  ] [DEBUG]  skip_severity = None, explicit_skip = [], regex_match = False, suppressed_policies: []
2023-07-20 09:36:45,548 [MainThread  ] [DEBUG]  bc_check_id = BC_REPO_GITLAB_CI_2, include_all_checkov_policies = True, is_external = False, explicit_run: []
2023-07-20 09:36:45,549 [MainThread  ] [DEBUG]  should_run_check CKV_GITLABCI_2: True
2023-07-20 09:36:45,546 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_2
2023-07-20 09:36:45,547 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_4
2023-07-20 09:36:45,547 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_13
2023-07-20 09:36:45,547 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_1
2023-07-20 09:36:45,551 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_GHA_1
2023-07-20 09:36:45,554 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_21
2023-07-20 09:36:45,549 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_28
2023-07-20 09:36:45,549 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_14
2023-07-20 09:36:45,550 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_37
2023-07-20 09:36:45,551 [MainThread  ] [ERROR]  Failed to invoke function /usr/local/lib/python3.11/site-packages/checkov/common/runners/runner_registry._parallel_run with <checkov.gitlab_ci.runner.Runner object at 0x7f14fdfb6d90>
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/checkov/common/parallelizer/parallel_runner.py", line 39, in func_wrapper
    result = original_func(item)
             ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/checkov/common/runners/runner_registry.py", line 127, in _parallel_run
    report = runner.run(
             ^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/checkov/gitlab_ci/runner.py", line 68, in run
    report = super().run(root_folder=root_folder, external_checks_dir=external_checks_dir,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/checkov/common/runners/object_runner.py", line 154, in run
    self.add_python_check_results(report=report, registry=registry, runner_filter=runner_filter, root_folder=root_folder)
  File "/usr/local/lib/python3.11/site-packages/checkov/common/runners/object_runner.py", line 173, in add_python_check_results
    results = registry.scan(file_path, self.definitions[file_path], skipped_checks, runner_filter)  # type:ignore[arg-type] # this is overridden in the subclass
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/checkov/yaml_doc/base_registry.py", line 226, in scan
    self._scan_yaml(
  File "/usr/local/lib/python3.11/site-packages/checkov/yaml_doc/base_registry.py", line 190, in _scan_yaml
    scanner(
  File "/usr/local/lib/python3.11/site-packages/checkov/yaml_doc/base_registry.py", line 59, in _scan_yaml_array
    skip_info = ([skip for skip in skip_infos if item[STARTLINE_MARK] <= skip["line_number"] <= item[ENDLINE_MARK]] or [{}])[0]
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/checkov/yaml_doc/base_registry.py", line 59, in <listcomp>
    skip_info = ([skip for skip in skip_infos if item[STARTLINE_MARK] <= skip["line_number"] <= item[ENDLINE_MARK]] or [{}])[0]
                                                 ~~~~^^^^^^^^^^^^^^^^
TypeError: list indices must be integers or slices, not str
2023-07-20 09:36:45,550 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_15
2023-07-20 09:36:45,551 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_20
2023-07-20 09:36:45,547 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_26
2023-07-20 09:36:45,554 [ThreadPoolEx] [DEBUG]  Running graph check: CKV_AZURE_24
2023-07-20 09:36:45,554 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_10
2023-07-20 09:36:45,554 [ThreadPoolEx] [DEBUG]  Running graph check: CKV_AZURE_120
2023-07-20 09:36:45,567 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_6
2023-07-20 09:36:45,568 [ThreadPoolEx] [DEBUG]  Running graph check: CKV_AZURE_119
2023-07-20 09:36:45,570 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_16
2023-07-20 09:36:45,570 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_9
2023-07-20 09:36:45,571 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_19
2023-07-20 09:36:45,571 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_23
2023-07-20 09:36:45,572 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_36
2023-07-20 09:36:45,572 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_32
2023-07-20 09:36:45,573 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_24
2023-07-20 09:36:45,573 [ThreadPoolEx] [DEBUG]  Running graph check: CKV_AZURE_23
2023-07-20 09:36:45,574 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_17
2023-07-20 09:36:45,578 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_33
2023-07-20 09:36:45,579 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_22
2023-07-20 09:36:45,579 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_30
2023-07-20 09:36:45,579 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_8
2023-07-20 09:36:45,585 [MainThread  ] [INFO ]  Creating Ansible graph
2023-07-20 09:36:45,579 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_38
2023-07-20 09:36:45,580 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_12
2023-07-20 09:36:45,586 [MainThread  ] [DEBUG]  [AnsibleLocalGraph] created 0 vertices
2023-07-20 09:36:45,586 [MainThread  ] [DEBUG]  [AnsibleLocalGraph] created 0 edges
2023-07-20 09:36:45,580 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_11
2023-07-20 09:36:45,587 [MainThread  ] [INFO ]  Successfully created Ansible graph
2023-07-20 09:36:45,581 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AZURE_29
2023-07-20 09:36:45,581 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AWS_8
2023-07-20 09:36:45,588 [MainThread  ] [DEBUG]  Loading external checks from /usr/local/lib/python3.11/site-packages/checkov/ansible/checks/graph_checks
2023-07-20 09:36:45,589 [MainThread  ] [DEBUG]  Searching through ['__pycache__'] and ['PanosPolicyDescription.json', 'DnfValidateCerts.json', 'PanosInterfaceMgmtProfileNoTelnet.json', 'PanosZoneUserIDIncludeACL.json', 'DnfDisableGpgCheck.json', 'PanosPolicyNoApplicationAny.json', 'PanosZoneProtectionProfile.json', 'DnfSslVerify.json', 'GetUrlHttpsOnly.json', 'PanosPolicyLogForwarding.json', 'PanosInterfaceMgmtProfileNoHTTP.json', 'PanosPolicyNoSrcAnyDstAny.json', 'PanosPolicyLoggingEnabled.json', 'PanosPolicyNoDSRI.json', 'BlockErrorHandling.json', 'UriHttpsOnly.json', '__init__.py', 'PanosPolicyNoServiceAny.json']
2023-07-20 09:36:45,582 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_AWS_39
...
2023-07-20 09:36:45,771 [MainThread  ] [DEBUG]  In get_exit_code; exit code thresholds: {'soft_fail': False, 'soft_fail_checks': [], 'soft_fail_threshold': None, 'hard_fail_checks': [], 'hard_fail_threshold': None}, hard_fail_on_parsing_errors: False
2023-07-20 09:36:45,771 [MainThread  ] [DEBUG]  No failed checks in this report - returning 0

       _               _
   ___| |__   ___  ___| | _______   __
  / __| '_ \ / _ \/ __| |/ / _ \ \ / /
 | (__| | | |  __/ (__|   < (_) \ V /
  \___|_| |_|\___|\___|_|\_\___/ \_/

By bridgecrew.io | version: 2.3.335


2023-07-20 09:36:45,772 [MainThread  ] [DEBUG]  Should run contributor metrics report: None
```

**Desktop (please complete the following information):**
 - OS: Debian 11
 - Checkov Version 2.3.335




Discussion:

Resolving patch:
diff --git a/checkov/yaml_doc/base_registry.py b/checkov/yaml_doc/base_registry.py
--- a/checkov/yaml_doc/base_registry.py
+++ b/checkov/yaml_doc/base_registry.py
@@ -53,10 +53,7 @@ def _scan_yaml_array(
                     if isinstance(item, str):
                         item = self.set_lines_for_item(item)
                     if STARTLINE_MARK != item and ENDLINE_MARK != item:
-                        skip_info: "_SkippedCheck" = {}
-                        if skip_infos and skip_infos[0]:
-                            # multiple items could be found, so we need to skip the correct one(s)
-                            skip_info = ([skip for skip in skip_infos if item[STARTLINE_MARK] <= skip["line_number"] <= item[ENDLINE_MARK]] or [{}])[0]
+                        skip_info = self._collect_inline_suppression_in_array(item=item, skip_infos=skip_infos)
 
                         self.update_result(
                             check,
@@ -347,3 +344,27 @@ def set_lines_for_item(self, item: str) -> dict[int | str, str | int] | str:
                 break
 
         return item_dict
+
+    def _collect_inline_suppression_in_array(self, item: Any, skip_infos: list[_SkippedCheck]) -> _SkippedCheck:
+        if skip_infos and skip_infos[0]:
+            if isinstance(item, dict):
+                # multiple items could be found, so we need to skip the correct one(s)
+                skip_info = [
+                    skip for skip in skip_infos if item[STARTLINE_MARK] <= skip["line_number"] <= item[ENDLINE_MARK]
+                ]
+                if skip_info:
+                    return skip_info[0]
+            elif isinstance(item, list):
+                # depending on the check a list of uncomplaint items can be found and need to be correctly matched
+                for sub_item in item:
+                    if isinstance(sub_item, dict):
+                        # only one of the list items need to be matched
+                        skip_info = [
+                            skip
+                            for skip in skip_infos
+                            if sub_item[STARTLINE_MARK] <= skip["line_number"] <= sub_item[ENDLINE_MARK]
+                        ]
+                        if skip_info:
+                            return skip_info[0]
+
+        return {}  # nothing found


Test patch:
diff --git a/tests/gitlab_ci/resources/rules/.gitlab-ci.yml b/tests/gitlab_ci/resources/rules/.gitlab-ci.yml
--- a/tests/gitlab_ci/resources/rules/.gitlab-ci.yml
+++ b/tests/gitlab_ci/resources/rules/.gitlab-ci.yml
@@ -14,3 +14,12 @@ planOnlySubset:
     - if: $CI_PIPELINE_SOURCE != "merge_request_event" && $CI_PIPELINE_SOURCE != "schedule"
       when: manual
       allow_failure: true
+
+jobSkip:
+  script: echo "This job creates double pipelines!"
+  rules:
+    - changes:
+        - $DOCKERFILES_DIR/*
+      # checkov:skip=CKV_GITLABCI_2: Ignore
+    - if: $CI_PIPELINE_SOURCE == "push"
+    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
diff --git a/tests/gitlab_ci/test_runner.py b/tests/gitlab_ci/test_runner.py
--- a/tests/gitlab_ci/test_runner.py
+++ b/tests/gitlab_ci/test_runner.py
@@ -22,7 +22,7 @@ def test_runner(self):
         self.assertEqual(len(report.failed_checks), 5)
         self.assertEqual(report.parsing_errors, [])
         self.assertEqual(len(report.passed_checks), 9)
-        self.assertEqual(report.skipped_checks, [])
+        self.assertEqual(len(report.skipped_checks), 1)
         report.print_console()
 
     def test_runner_honors_enforcement_rules(self):