We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
CheckOV can't check bicep files with modules published in Azure container registry
**Describe the issue**
In a larger Bicep environment, we publish entire solutions to the Azure Container Registry. These solutions are called by users as modules in their Bicep deployments. Therefore, it is mandatory for us that CheckOV supports scanning of such environments.

In our view, these two solutions would sufficiently address the problem, with the first solution being our favorite:

1. CheckOV downloads the modules from the Azure container registry to enable scanning of the code.
2. CheckOV checks if the Azure container registry used is whitelisted and then scans only the available code. If the registry used is not whitelisted, CheckOV returns a hardfail.

The second option would be a workaround for us, as we only want users to use our registry. The modules that are published in this registry have been scanned by checkov before publishing.

In the current version of checkov (2.3.152) the scan of the bicep file fails with a parsing error.

**Example Value**
``` bicep
module modSampleSolution 'br:sampleregistry.azurecr.io/bicep/modules/company.department/sampleSolution:1.0.0' = {
  name: 'sampleSolution-deploy'
  params: {
    parSampleParameter: 'Sample'
  }
}
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `setup.py`
Content:
```
1 #!/usr/bin/env python
2 import json
3 import logging
4 import os
5 from importlib import util
6 from os import path
7 from pathlib import Path
8 
9 from setuptools import setup, find_packages
10 from setuptools.command.build_py import build_py
11 
12 
13 class PreBuildCommand(build_py):
14     """Pre-build command"""
15 
16     def transform_graph_yaml_to_json(self) -> None:
17         """Transforms YAML graph checks to JSON and copies them to build/lib"""
18 
19         import yaml  # can't be top-level, because it needs to be first installed via 'setup_requires'
20 
21         graph_check_paths = ("checkov/*/checks/graph_checks",)
22         build_path = Path(self.build_lib)
23         src_path = Path()
24 
25         for graph_check_path in graph_check_paths:
26             for yaml_file in src_path.glob(f"{graph_check_path}/**/*.yaml"):
27                 json_file = (build_path / yaml_file).with_suffix(".json")
28                 self.mkpath(str(json_file.parent))
29                 json_file.write_text(json.dumps(yaml.safe_load(yaml_file.read_text())))
30 
31     def run(self) -> None:
32         self.execute(self.transform_graph_yaml_to_json, ())
33         build_py.run(self)
34 
35 
36 # read the contents of your README file
37 this_directory = path.abspath(path.dirname(__file__))
38 with open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
39     long_description = f.read()
40 
41 logger = logging.getLogger(__name__)
42 spec = util.spec_from_file_location(
43     "checkov.version", os.path.join("checkov", "version.py")
44 )
45 # noinspection PyUnresolvedReferences
46 mod = util.module_from_spec(spec)
47 spec.loader.exec_module(mod)  # type: ignore
48 version = mod.version  # type: ignore
49 
50 setup(
51     cmdclass={
52         "build_py": PreBuildCommand,
53     },
54     setup_requires=[
55         "pyyaml",
56     ],
57     extras_require={
58         "dev": [
59             "pytest==5.3.1",
60             "coverage==5.5",
61             "coverage-badge",
62             "GitPython==3.1.7",
63             "bandit",
64             "jsonschema",
65         ]
66     },
67     install_requires=[
68         "bc-python-hcl2==0.3.51",
69         "bc-detect-secrets==1.4.24",
70         "bc-jsonpath-ng==1.5.9",
71         "deep-merge",
72         "tabulate",
73         "colorama",
74         "termcolor",
75         "junit-xml>=1.9",
76         "dpath==2.1.3",
77         "pyyaml>=5.4.1",
78         "boto3>=1.17",
79         "gitpython",
80         "jmespath",
81         "tqdm",
82         "update-checker",
83         "semantic-version",
84         "packaging",
85         "cloudsplaining>=0.4.3",
86         "networkx<2.7",
87         "igraph",
88         "dockerfile-parse",
89         "docker",
90         "configargparse",
91         "argcomplete",
92         "policyuniverse",
93         "typing-extensions>=4.1.0",
94         "importlib-metadata>=0.12",
95         "cachetools",
96         "cyclonedx-python-lib<4.0.0,>=2.4.0",
97         "packageurl-python",
98         "click>=8.0.0",
99         "aiohttp",
100         "aiodns",
101         "aiomultiprocess",
102         "jsonschema<5.0.0,>=4.6.0",
103         "prettytable>=3.0.0",
104         "pycep-parser==0.3.9",
105         "charset-normalizer",
106         "pyston-autoload==2.3.5; python_version < '3.11' and (sys_platform == 'linux' or sys_platform == 'darwin') and platform_machine == 'x86_64' and implementation_name == 'cpython'",
107         "pyston==2.3.5; python_version < '3.11' and (sys_platform == 'linux' or sys_platform == 'darwin') and platform_machine == 'x86_64' and implementation_name == 'cpython'",
108         "schema",
109         "requests>=2.27.0",
110         "yarl",
111         "openai",
112     ],
113     dependency_links=[],  # keep it empty, needed for pipenv-setup
114     license="Apache License 2.0",
115     name="checkov",
116     version=version,
117     python_requires=">=3.7",
118     description="Infrastructure as code static analysis",
119     author="bridgecrew",
120     author_email="meet@bridgecrew.io",
121     url="https://github.com/bridgecrewio/checkov",
122     packages=find_packages(
123         exclude=[
124             "dogfood_tests*",
125             "flake8_plugins*",
126             "integration_tests*",
127             "performance_tests*",
128             "tests*",
129         ]
130     ),
131     include_package_data=True,
132     package_data={
133         "checkov": ["py.typed"],
134         "checkov.common.util.templates": ["*.jinja2"],
135         "checkov.ansible.checks.graph_checks": ["**/*.json"],
136         "checkov.arm.checks.graph_checks": ["**/*.json"],
137         "checkov.bicep.checks.graph_checks": ["**/*.json"],
138         "checkov.cloudformation.checks.graph_checks": ["**/*.json"],
139         "checkov.dockerfile.checks.graph_checks": ["**/*.json"],
140         "checkov.github_actions.checks.graph_checks": ["**/*.json"],
141         "checkov.kubernetes.checks.graph_checks": ["**/*.json"],
142         "checkov.terraform.checks.graph_checks": ["**/*.json"],
143     },
144     scripts=["bin/checkov", "bin/checkov.cmd"],
145     long_description=long_description,
146     long_description_content_type="text/markdown",
147     classifiers=[
148         "Environment :: Console",
149         "Intended Audience :: Developers",
150         "Intended Audience :: System Administrators",
151         "License :: OSI Approved :: Apache Software License",
152         "Programming Language :: Python :: 3 :: Only",
153         "Programming Language :: Python :: 3.7",
154         "Programming Language :: Python :: 3.8",
155         "Programming Language :: Python :: 3.9",
156         "Programming Language :: Python :: 3.10",
157         "Programming Language :: Python :: 3.11",
158         "Topic :: Security",
159         "Topic :: Software Development :: Build Tools",
160         "Typing :: Typed",
161     ],
162 )
163
```
--- 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/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -101,7 +101,7 @@
         "aiomultiprocess",
         "jsonschema<5.0.0,>=4.6.0",
         "prettytable>=3.0.0",
-        "pycep-parser==0.3.9",
+        "pycep-parser==0.4.0",
         "charset-normalizer",
         "pyston-autoload==2.3.5; python_version < '3.11' and (sys_platform == 'linux' or sys_platform == 'darwin') and platform_machine == 'x86_64' and implementation_name == 'cpython'",
         "pyston==2.3.5; python_version < '3.11' and (sys_platform == 'linux' or sys_platform == 'darwin') and platform_machine == 'x86_64' and implementation_name == 'cpython'",

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -101,7 +101,7 @@\n         \"aiomultiprocess\",\n         \"jsonschema<5.0.0,>=4.6.0\",\n         \"prettytable>=3.0.0\",\n-        \"pycep-parser==0.3.9\",\n+        \"pycep-parser==0.4.0\",\n         \"charset-normalizer\",\n         \"pyston-autoload==2.3.5; python_version < '3.11' and (sys_platform == 'linux' or sys_platform == 'darwin') and platform_machine == 'x86_64' and implementation_name == 'cpython'\",\n         \"pyston==2.3.5; python_version < '3.11' and (sys_platform == 'linux' or sys_platform == 'darwin') and platform_machine == 'x86_64' and implementation_name == 'cpython'\",\n", "issue": "CheckOV can't check bicep files with modules published in Azure container registry\n**Describe the issue**\r\nIn a larger Bicep environment, we publish entire solutions to the Azure Container Registry. These solutions are called by users as modules in their Bicep deployments. Therefore, it is mandatory for us that CheckOV supports scanning of such environments.\r\n\r\nIn our view, these two solutions would sufficiently address the problem, with the first solution being our favorite:\r\n\r\n1. CheckOV downloads the modules from the Azure container registry to enable scanning of the code.\r\n2. CheckOV checks if the Azure container registry used is whitelisted and then scans only the available code. If the registry used is not whitelisted, CheckOV returns a hardfail.\r\n\r\nThe second option would be a workaround for us, as we only want users to use our registry. The modules that are published in this registry have been scanned by checkov before publishing.\r\n\r\nIn the current version of checkov (2.3.152) the scan of the bicep file fails with a parsing error.\r\n\r\n**Example Value**\r\n``` bicep\r\nmodule modSampleSolution 'br:sampleregistry.azurecr.io/bicep/modules/company.department/sampleSolution:1.0.0' = {\r\n  name: 'sampleSolution-deploy'\r\n  params: {\r\n    parSampleParameter: 'Sample'\r\n  }\r\n}\r\n```\n", "before_files": [{"content": "#!/usr/bin/env python\nimport json\nimport logging\nimport os\nfrom importlib import util\nfrom os import path\nfrom pathlib import Path\n\nfrom setuptools import setup, find_packages\nfrom setuptools.command.build_py import build_py\n\n\nclass PreBuildCommand(build_py):\n    \"\"\"Pre-build command\"\"\"\n\n    def transform_graph_yaml_to_json(self) -> None:\n        \"\"\"Transforms YAML graph checks to JSON and copies them to build/lib\"\"\"\n\n        import yaml  # can't be top-level, because it needs to be first installed via 'setup_requires'\n\n        graph_check_paths = (\"checkov/*/checks/graph_checks\",)\n        build_path = Path(self.build_lib)\n        src_path = Path()\n\n        for graph_check_path in graph_check_paths:\n            for yaml_file in src_path.glob(f\"{graph_check_path}/**/*.yaml\"):\n                json_file = (build_path / yaml_file).with_suffix(\".json\")\n                self.mkpath(str(json_file.parent))\n                json_file.write_text(json.dumps(yaml.safe_load(yaml_file.read_text())))\n\n    def run(self) -> None:\n        self.execute(self.transform_graph_yaml_to_json, ())\n        build_py.run(self)\n\n\n# read the contents of your README file\nthis_directory = path.abspath(path.dirname(__file__))\nwith open(path.join(this_directory, \"README.md\"), encoding=\"utf-8\") as f:\n    long_description = f.read()\n\nlogger = logging.getLogger(__name__)\nspec = util.spec_from_file_location(\n    \"checkov.version\", os.path.join(\"checkov\", \"version.py\")\n)\n# noinspection PyUnresolvedReferences\nmod = util.module_from_spec(spec)\nspec.loader.exec_module(mod)  # type: ignore\nversion = mod.version  # type: ignore\n\nsetup(\n    cmdclass={\n        \"build_py\": PreBuildCommand,\n    },\n    setup_requires=[\n        \"pyyaml\",\n    ],\n    extras_require={\n        \"dev\": [\n            \"pytest==5.3.1\",\n            \"coverage==5.5\",\n            \"coverage-badge\",\n            \"GitPython==3.1.7\",\n            \"bandit\",\n            \"jsonschema\",\n        ]\n    },\n    install_requires=[\n        \"bc-python-hcl2==0.3.51\",\n        \"bc-detect-secrets==1.4.24\",\n        \"bc-jsonpath-ng==1.5.9\",\n        \"deep-merge\",\n        \"tabulate\",\n        \"colorama\",\n        \"termcolor\",\n        \"junit-xml>=1.9\",\n        \"dpath==2.1.3\",\n        \"pyyaml>=5.4.1\",\n        \"boto3>=1.17\",\n        \"gitpython\",\n        \"jmespath\",\n        \"tqdm\",\n        \"update-checker\",\n        \"semantic-version\",\n        \"packaging\",\n        \"cloudsplaining>=0.4.3\",\n        \"networkx<2.7\",\n        \"igraph\",\n        \"dockerfile-parse\",\n        \"docker\",\n        \"configargparse\",\n        \"argcomplete\",\n        \"policyuniverse\",\n        \"typing-extensions>=4.1.0\",\n        \"importlib-metadata>=0.12\",\n        \"cachetools\",\n        \"cyclonedx-python-lib<4.0.0,>=2.4.0\",\n        \"packageurl-python\",\n        \"click>=8.0.0\",\n        \"aiohttp\",\n        \"aiodns\",\n        \"aiomultiprocess\",\n        \"jsonschema<5.0.0,>=4.6.0\",\n        \"prettytable>=3.0.0\",\n        \"pycep-parser==0.3.9\",\n        \"charset-normalizer\",\n        \"pyston-autoload==2.3.5; python_version < '3.11' and (sys_platform == 'linux' or sys_platform == 'darwin') and platform_machine == 'x86_64' and implementation_name == 'cpython'\",\n        \"pyston==2.3.5; python_version < '3.11' and (sys_platform == 'linux' or sys_platform == 'darwin') and platform_machine == 'x86_64' and implementation_name == 'cpython'\",\n        \"schema\",\n        \"requests>=2.27.0\",\n        \"yarl\",\n        \"openai\",\n    ],\n    dependency_links=[],  # keep it empty, needed for pipenv-setup\n    license=\"Apache License 2.0\",\n    name=\"checkov\",\n    version=version,\n    python_requires=\">=3.7\",\n    description=\"Infrastructure as code static analysis\",\n    author=\"bridgecrew\",\n    author_email=\"meet@bridgecrew.io\",\n    url=\"https://github.com/bridgecrewio/checkov\",\n    packages=find_packages(\n        exclude=[\n            \"dogfood_tests*\",\n            \"flake8_plugins*\",\n            \"integration_tests*\",\n            \"performance_tests*\",\n            \"tests*\",\n        ]\n    ),\n    include_package_data=True,\n    package_data={\n        \"checkov\": [\"py.typed\"],\n        \"checkov.common.util.templates\": [\"*.jinja2\"],\n        \"checkov.ansible.checks.graph_checks\": [\"**/*.json\"],\n        \"checkov.arm.checks.graph_checks\": [\"**/*.json\"],\n        \"checkov.bicep.checks.graph_checks\": [\"**/*.json\"],\n        \"checkov.cloudformation.checks.graph_checks\": [\"**/*.json\"],\n        \"checkov.dockerfile.checks.graph_checks\": [\"**/*.json\"],\n        \"checkov.github_actions.checks.graph_checks\": [\"**/*.json\"],\n        \"checkov.kubernetes.checks.graph_checks\": [\"**/*.json\"],\n        \"checkov.terraform.checks.graph_checks\": [\"**/*.json\"],\n    },\n    scripts=[\"bin/checkov\", \"bin/checkov.cmd\"],\n    long_description=long_description,\n    long_description_content_type=\"text/markdown\",\n    classifiers=[\n        \"Environment :: Console\",\n        \"Intended Audience :: Developers\",\n        \"Intended Audience :: System Administrators\",\n        \"License :: OSI Approved :: Apache Software License\",\n        \"Programming Language :: Python :: 3 :: Only\",\n        \"Programming Language :: Python :: 3.7\",\n        \"Programming Language :: Python :: 3.8\",\n        \"Programming Language :: Python :: 3.9\",\n        \"Programming Language :: Python :: 3.10\",\n        \"Programming Language :: Python :: 3.11\",\n        \"Topic :: Security\",\n        \"Topic :: Software Development :: Build Tools\",\n        \"Typing :: Typed\",\n    ],\n)\n", "path": "setup.py"}], "after_files": [{"content": "#!/usr/bin/env python\nimport json\nimport logging\nimport os\nfrom importlib import util\nfrom os import path\nfrom pathlib import Path\n\nfrom setuptools import setup, find_packages\nfrom setuptools.command.build_py import build_py\n\n\nclass PreBuildCommand(build_py):\n    \"\"\"Pre-build command\"\"\"\n\n    def transform_graph_yaml_to_json(self) -> None:\n        \"\"\"Transforms YAML graph checks to JSON and copies them to build/lib\"\"\"\n\n        import yaml  # can't be top-level, because it needs to be first installed via 'setup_requires'\n\n        graph_check_paths = (\"checkov/*/checks/graph_checks\",)\n        build_path = Path(self.build_lib)\n        src_path = Path()\n\n        for graph_check_path in graph_check_paths:\n            for yaml_file in src_path.glob(f\"{graph_check_path}/**/*.yaml\"):\n                json_file = (build_path / yaml_file).with_suffix(\".json\")\n                self.mkpath(str(json_file.parent))\n                json_file.write_text(json.dumps(yaml.safe_load(yaml_file.read_text())))\n\n    def run(self) -> None:\n        self.execute(self.transform_graph_yaml_to_json, ())\n        build_py.run(self)\n\n\n# read the contents of your README file\nthis_directory = path.abspath(path.dirname(__file__))\nwith open(path.join(this_directory, \"README.md\"), encoding=\"utf-8\") as f:\n    long_description = f.read()\n\nlogger = logging.getLogger(__name__)\nspec = util.spec_from_file_location(\n    \"checkov.version\", os.path.join(\"checkov\", \"version.py\")\n)\n# noinspection PyUnresolvedReferences\nmod = util.module_from_spec(spec)\nspec.loader.exec_module(mod)  # type: ignore\nversion = mod.version  # type: ignore\n\nsetup(\n    cmdclass={\n        \"build_py\": PreBuildCommand,\n    },\n    setup_requires=[\n        \"pyyaml\",\n    ],\n    extras_require={\n        \"dev\": [\n            \"pytest==5.3.1\",\n            \"coverage==5.5\",\n            \"coverage-badge\",\n            \"GitPython==3.1.7\",\n            \"bandit\",\n            \"jsonschema\",\n        ]\n    },\n    install_requires=[\n        \"bc-python-hcl2==0.3.51\",\n        \"bc-detect-secrets==1.4.24\",\n        \"bc-jsonpath-ng==1.5.9\",\n        \"deep-merge\",\n        \"tabulate\",\n        \"colorama\",\n        \"termcolor\",\n        \"junit-xml>=1.9\",\n        \"dpath==2.1.3\",\n        \"pyyaml>=5.4.1\",\n        \"boto3>=1.17\",\n        \"gitpython\",\n        \"jmespath\",\n        \"tqdm\",\n        \"update-checker\",\n        \"semantic-version\",\n        \"packaging\",\n        \"cloudsplaining>=0.4.3\",\n        \"networkx<2.7\",\n        \"igraph\",\n        \"dockerfile-parse\",\n        \"docker\",\n        \"configargparse\",\n        \"argcomplete\",\n        \"policyuniverse\",\n        \"typing-extensions>=4.1.0\",\n        \"importlib-metadata>=0.12\",\n        \"cachetools\",\n        \"cyclonedx-python-lib<4.0.0,>=2.4.0\",\n        \"packageurl-python\",\n        \"click>=8.0.0\",\n        \"aiohttp\",\n        \"aiodns\",\n        \"aiomultiprocess\",\n        \"jsonschema<5.0.0,>=4.6.0\",\n        \"prettytable>=3.0.0\",\n        \"pycep-parser==0.4.0\",\n        \"charset-normalizer\",\n        \"pyston-autoload==2.3.5; python_version < '3.11' and (sys_platform == 'linux' or sys_platform == 'darwin') and platform_machine == 'x86_64' and implementation_name == 'cpython'\",\n        \"pyston==2.3.5; python_version < '3.11' and (sys_platform == 'linux' or sys_platform == 'darwin') and platform_machine == 'x86_64' and implementation_name == 'cpython'\",\n        \"schema\",\n        \"requests>=2.27.0\",\n        \"yarl\",\n        \"openai\",\n    ],\n    dependency_links=[],  # keep it empty, needed for pipenv-setup\n    license=\"Apache License 2.0\",\n    name=\"checkov\",\n    version=version,\n    python_requires=\">=3.7\",\n    description=\"Infrastructure as code static analysis\",\n    author=\"bridgecrew\",\n    author_email=\"meet@bridgecrew.io\",\n    url=\"https://github.com/bridgecrewio/checkov\",\n    packages=find_packages(\n        exclude=[\n            \"dogfood_tests*\",\n            \"flake8_plugins*\",\n            \"integration_tests*\",\n            \"performance_tests*\",\n            \"tests*\",\n        ]\n    ),\n    include_package_data=True,\n    package_data={\n        \"checkov\": [\"py.typed\"],\n        \"checkov.common.util.templates\": [\"*.jinja2\"],\n        \"checkov.ansible.checks.graph_checks\": [\"**/*.json\"],\n        \"checkov.arm.checks.graph_checks\": [\"**/*.json\"],\n        \"checkov.bicep.checks.graph_checks\": [\"**/*.json\"],\n        \"checkov.cloudformation.checks.graph_checks\": [\"**/*.json\"],\n        \"checkov.dockerfile.checks.graph_checks\": [\"**/*.json\"],\n        \"checkov.github_actions.checks.graph_checks\": [\"**/*.json\"],\n        \"checkov.kubernetes.checks.graph_checks\": [\"**/*.json\"],\n        \"checkov.terraform.checks.graph_checks\": [\"**/*.json\"],\n    },\n    scripts=[\"bin/checkov\", \"bin/checkov.cmd\"],\n    long_description=long_description,\n    long_description_content_type=\"text/markdown\",\n    classifiers=[\n        \"Environment :: Console\",\n        \"Intended Audience :: Developers\",\n        \"Intended Audience :: System Administrators\",\n        \"License :: OSI Approved :: Apache Software License\",\n        \"Programming Language :: Python :: 3 :: Only\",\n        \"Programming Language :: Python :: 3.7\",\n        \"Programming Language :: Python :: 3.8\",\n        \"Programming Language :: Python :: 3.9\",\n        \"Programming Language :: Python :: 3.10\",\n        \"Programming Language :: Python :: 3.11\",\n        \"Topic :: Security\",\n        \"Topic :: Software Development :: Build Tools\",\n        \"Typing :: Typed\",\n    ],\n)\n", "path": "setup.py"}]}