From f32aae6138dcdaa30d7a1c6a9ad6aa204b3d8dde Mon Sep 17 00:00:00 2001 From: Barak Fatal <35402131+bo156@users.noreply.github.com> Date: Tue, 26 Sep 2023 13:45:11 +0300 Subject: [PATCH] Revert "feat(general): Revert add rustworkx (#5565)" (#5594)" This reverts commit 7a83bdfb03f78612805cc1b6e1377755a6ede83d. --- Pipfile | 1 + Pipfile.lock | 309 +++++++++++++----- checkov/common/bridgecrew/wrapper.py | 23 +- .../base_attribute_solver.py | 12 +- .../complex_solvers/base_complex_solver.py | 14 +- .../base_connection_solver.py | 32 +- .../connection_exists_solver.py | 204 ++++++++---- checkov/common/graph/checks_infra/registry.py | 1 + .../graph/db_connectors/rustworkx/__init__.py | 0 .../rustworkx/rustworkx_db_connector.py | 52 +++ checkov/common/graph/db_connectors/utils.py | 15 + checkov/common/runners/base_runner.py | 5 +- checkov/common/typing.py | 5 +- setup.py | 1 + .../checks/graph_checks/test_yaml_policies.py | 11 +- .../checks/test_yaml_policies.py | 11 +- .../bicep/graph/checks/test_yaml_policies.py | 12 +- .../graph/checks/test_yaml_policies.py | 11 +- .../checks/test_yaml_policies.py | 13 +- .../checks/graph_checks/test_yaml_policies.py | 11 +- .../graph/checks/test_yaml_policies.py | 11 +- .../contains_solver/test_solver.py | 3 +- .../ending_with_solver/test_solver.py | 3 +- .../equals_ignore_case_solver/test_solver.py | 3 +- .../equals_solver/test_solver.py | 3 +- .../exists_solver/test_solver.py | 3 +- .../greater_than_solver/test_solver.py | 3 +- .../intersects_solver/test_solver.py | 3 +- .../is_empty_solver/test_solver.py | 3 +- .../is_false_solver/test_solver.py | 3 +- .../is_not_empty_solver/test_solver.py | 3 +- .../is_true_solver/test_solver.py | 3 +- .../jsonpath_equals_solver/test_solver.py | 3 +- .../jsonpath_exists_solver/test_solver.py | 3 +- .../jsonpath_not_equals_solver/test_solver.py | 3 +- .../jsonpath_not_exists_solver/test_solver.py | 3 +- .../length_equals_solver/test_solver.py | 3 +- .../test_solver.py | 3 +- .../length_greater_than_solver/test_solver.py | 3 +- .../test_solver.py | 3 +- .../length_less_than_solver/test_solver.py | 3 +- .../length_not_equals_solver/test_solver.py | 3 +- .../not_contains_solver/test_solver.py | 3 +- .../not_ending_with_solver/test_solver.py | 3 +- .../test_solver.py | 3 +- .../not_equals_solver/test_solver.py | 3 +- .../not_exists_solver/test_solver.py | 3 +- .../not_intersects_solver/test_solver.py | 3 +- .../not_regex_match_solver/test_solver.py | 3 +- .../not_starting_with_solver/test_solver.py | 3 +- .../not_subset_solver/test_solver.py | 3 +- .../not_within_solver/test_solver.py | 3 +- .../test_solver.py | 3 +- .../test_solver.py | 3 +- .../test_solver.py | 3 +- .../test_solver.py | 3 +- .../test_solver.py | 3 +- .../test_solver.py | 3 +- .../range_includes_solver/test_solver.py | 3 +- .../range_not_includes_solver/test_solver.py | 3 +- .../regex_match_solver/test_solver.py | 3 +- .../starting_with_solver/test_solver.py | 3 +- .../subset_solver/test_solver.py | 3 +- .../within_solver/test_solver.py | 3 +- .../complex_solvers/and_solver/test_solver.py | 3 +- .../complex_solvers/not_solver/test_solver.py | 3 +- .../complex_solvers/or_solver/test_solver.py | 3 +- .../and_connection_solver/test_solver.py | 3 +- .../connection_exist_solver/test_solver.py | 3 +- .../test_solver.py | 3 +- .../connection_one_exists/test_solver.py | 3 +- .../or_connection_solver/test_solver.py | 3 +- .../db_connector/test_graph_connector.py | 10 + .../graph/graph_builder/test_graph_builder.py | 39 +++ tests/terraform/runner/test_plan_runner.py | 4 +- tests/terraform/runner/test_runner.py | 11 +- 76 files changed, 715 insertions(+), 256 deletions(-) create mode 100644 checkov/common/graph/db_connectors/rustworkx/__init__.py create mode 100644 checkov/common/graph/db_connectors/rustworkx/rustworkx_db_connector.py create mode 100644 checkov/common/graph/db_connectors/utils.py diff --git a/Pipfile b/Pipfile index 9a810480c37..d9157e49b58 100644 --- a/Pipfile +++ b/Pipfile @@ -89,6 +89,7 @@ yarl = "*" openai = "*" spdx-tools = ">=0.8.0,<0.9.0" license-expression = "*" +rustworkx = "*" [requires] python_version = "3.8" diff --git a/Pipfile.lock b/Pipfile.lock index 7691cc1b626..9207728b851 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "e0ea76e9bcacf1083c0a593b9f9ef0a05a5ab57c5f682fff2a026bde0ce67c44" + "sha256": "a4b0f4a578e3780d3bc73303958d713386c1986b295a3db052491a47d4b354e8" }, "pipfile-spec": 6, "requires": { @@ -115,6 +115,7 @@ "sha256:fd1ed388ea7fbed22c4968dd64bab0198de60750a25fe8c0c9d4bef5abe13824" ], "index": "pypi", + "markers": "python_version >= '3.6'", "version": "==3.8.5" }, "aiomultiprocess": { @@ -123,6 +124,7 @@ "sha256:3036c4c881cfbc63674686e036097f22309017c6bf96b04722a542ac9cac7423" ], "index": "pypi", + "markers": "python_version >= '3.6'", "version": "==0.9.0" }, "aiosignal": { @@ -135,11 +137,12 @@ }, "argcomplete": { "hashes": [ - "sha256:35fa893a88deea85ea7b20d241100e64516d6af6d7b0ae2bed1d263d26f70948", - "sha256:6c4c563f14f01440aaffa3eae13441c5db2357b5eec639abe7c0b15334627dff" + "sha256:d5d1e5efd41435260b8f85673b74ea2e883affcbec9f4230c582689e8e78251b", + "sha256:d97c036d12a752d1079f190bc1521c545b941fda89ad85d15afa909b4d1b9a99" ], "index": "pypi", - "version": "==3.1.1" + "markers": "python_version >= '3.6'", + "version": "==3.1.2" }, "async-timeout": { "hashes": [ @@ -163,6 +166,7 @@ "sha256:99fd6a7e5033ea3a4532d3ccc11b3f669c447da0109e0cb9d66998f4131dba0c" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==1.4.30" }, "bc-jsonpath-ng": { @@ -171,6 +175,7 @@ "sha256:5e72d78887521469f8a52966f6f0664ec3d59dcb2cebf85b8131867a241c84ec" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==1.5.9" }, "bc-python-hcl2": { @@ -179,15 +184,16 @@ "sha256:ab72880dd58689a4ee9a47f229788311a2b4d607fe034a819a40a63dab432644" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==0.3.51" }, "beartype": { "hashes": [ - "sha256:231379a056da2fc1811a2e1324d5c3d0fa2082e305bfa15cb3acb9b7ce9df516", - "sha256:f0aa0f09468f732c9c4d07c024d3d69cff64cb07fd81e8ab52962e1db16ff04a" + "sha256:47ec1c8c3be3f999f4f9f829e8913f65926aa7e85b180d9ffd305dc78d3e7d7b", + "sha256:72d133615fe674affc8c49365dd24dfe2260552b9a8a2b7193cdd48021527782" ], "markers": "python_full_version >= '3.8.0'", - "version": "==0.16.0" + "version": "==0.16.2" }, "beautifulsoup4": { "hashes": [ @@ -206,19 +212,20 @@ }, "boto3": { "hashes": [ - "sha256:519639859a3c829ccf7073a58b3716cb26cb5906e306fe63eb4beab68bf9bfab", - "sha256:c9fad1b01a1d7e7bd51150b3175b4c32b79d699ce94708082611f59fde2e097a" + "sha256:22e37d8c4f2d97b5e5c6ccc1d9edc7760717990b0ba8b8ea17a58cc87e57c5c9", + "sha256:3cb2aee317a1b8686e3b23674e4099b8ff7451bd8acc61b9719acff86fa024d1" ], "index": "pypi", - "version": "==1.28.49" + "markers": "python_version >= '3.7'", + "version": "==1.28.54" }, "botocore": { "hashes": [ - "sha256:7d64cb45154e4f34f3a45f551e118caad7379ae831565639e0afe5b2af126c61", - "sha256:95e9716f27f67d4207f260ab0ea157603ca544d3b82c5f21728b1c732bec1817" + "sha256:71fdb337ddcdb6bf378e1211cba9ce754c35f12b1524c7d0c0c147b2310356c7", + "sha256:c98e78a9490c4166b205f87912b46770e156bfe7d53bae54ccbd49c68a336ec6" ], "markers": "python_version >= '3.7'", - "version": "==1.31.49" + "version": "==1.31.54" }, "cached-property": { "hashes": [ @@ -233,6 +240,7 @@ "sha256:dce83f2d9b4e1f732a8cd44af8e8fab2dbe46201467fc98b3ef8f269092bf62b" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==5.3.1" }, "certifi": { @@ -391,6 +399,7 @@ "sha256:f87f746ee241d30d6ed93969de31e5ffd09a2961a051e60ae6bddde9ec3583aa" ], "index": "pypi", + "markers": "python_full_version >= '3.7.0'", "version": "==3.2.0" }, "click": { @@ -399,6 +408,7 @@ "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==8.1.7" }, "click-option-group": { @@ -415,6 +425,7 @@ "sha256:afa27770d97720dc4bddb3c11f50bd287f1ab1fdd908538e896e23c70a0d9c5f" ], "index": "pypi", + "markers": "python_version >= '3.6'", "version": "==0.6.1" }, "colorama": { @@ -423,6 +434,7 @@ "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6" ], "index": "pypi", + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6'", "version": "==0.4.6" }, "configargparse": { @@ -431,6 +443,7 @@ "sha256:e7067471884de5478c58a511e529f0f9bd1c66bfef1dea90935438d6c23306d1" ], "index": "pypi", + "markers": "python_version >= '3.5'", "version": "==1.7" }, "contextlib2": { @@ -447,6 +460,7 @@ "sha256:8981ca462fba91469c268d684a03f72c89c7a807674d884f83a28d8c2822a9b6" ], "index": "pypi", + "markers": "python_version >= '3.6' and python_version < '4.0'", "version": "==3.1.5" }, "decorator": { @@ -471,6 +485,7 @@ "sha256:aecd2277b8bf8e506e484f6ab7aec39abe0038e29fa4a6d3ba86c3fe01844ed9" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==6.1.3" }, "dockerfile-parse": { @@ -479,6 +494,7 @@ "sha256:bdffd126d2eb26acf1066acb54cb2e336682e1d72b974a40894fac76a4df17f6" ], "index": "pypi", + "markers": "python_version >= '3.6'", "version": "==2.0.1" }, "dpath": { @@ -487,6 +503,7 @@ "sha256:d9560e03ccd83b3c6f29988b0162ce9b34fd28b9d8dbda46663b20c68d9cdae3" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==2.1.3" }, "frozenlist": { @@ -566,11 +583,12 @@ }, "gitpython": { "hashes": [ - "sha256:4bb0c2a6995e85064140d31a33289aa5dce80133a23d36fcd372d716c54d3ebf", - "sha256:8d22b5cfefd17c79914226982bb7851d6ade47545b1735a9d010a2a4c26d8388" + "sha256:5f4c4187de49616d710a77e98ddf17b4782060a1788df441846bddefbb89ab33", + "sha256:f9b9ddc0761c125d5780eab2d64be4873fc6817c2899cbcb34b02344bdc7bc54" ], "index": "pypi", - "version": "==3.1.36" + "markers": "python_version >= '3.7'", + "version": "==3.1.37" }, "idna": { "hashes": [ @@ -634,6 +652,7 @@ "sha256:fc4021242f00adb150e759692da065bddef5af22afea387cd5a726461946b93b" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==0.10.8" }, "importlib-metadata": { @@ -642,15 +661,16 @@ "sha256:dbace7892d8c0c4ac1ad096662232f831d4e64f4c4545bd53016a3e9d4654743" ], "index": "pypi", + "markers": "python_version >= '3.8'", "version": "==6.8.0" }, "importlib-resources": { "hashes": [ - "sha256:134832a506243891221b88b4ae1213327eea96ceb4e407a00d790bb0626f45cf", - "sha256:4359457e42708462b9626a04657c6208ad799ceb41e5c58c57ffa0e6a098a5d4" + "sha256:9d48dcccc213325e810fd723e7fbb45ccb39f6cf5c31f00cf2b965f5f10f3cb9", + "sha256:aa50258bbfa56d4e33fbd8aa3ef48ded10d1735f11532b8df95388cc6bdb7e83" ], "markers": "python_version < '3.9'", - "version": "==6.0.1" + "version": "==6.1.0" }, "isodate": { "hashes": [ @@ -673,15 +693,17 @@ "sha256:90261b206d6defd58fdd5e85f478bf633a2901798906be2ad389150c5c60edbe" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==1.0.1" }, "jsonschema": { "hashes": [ - "sha256:043dc26a3845ff09d20e4420d6012a9c91c9aa8999fa184e7efcfeccb41e32cb", - "sha256:6e1e7569ac13be8139b2dd2c21a55d350066ee3f80df06c608b398cdc6f30e8f" + "sha256:cd5f1f9ed9444e554b38ba003af06c0a8c2868131e56bfbef0550fb450c0330e", + "sha256:ec84cc37cfa703ef7cd4928db24f9cb31428a5d0fa77747b8b51a847458e0bbf" ], "index": "pypi", - "version": "==4.19.0" + "markers": "python_version >= '3.8'", + "version": "==4.19.1" }, "jsonschema-specifications": { "hashes": [ @@ -713,6 +735,7 @@ "sha256:8d7e5e2de0d04fc104a4f952c440e8f08a5ba63480a0dad015b294770b7e58ec" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==30.1.1" }, "markdown": { @@ -875,15 +898,51 @@ "sha256:c0946ed31d71f1b732b5aaa6da5a0388a345019af232ce2f49c766e2d6795c51" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==2.6.3" }, + "numpy": { + "hashes": [ + "sha256:04640dab83f7c6c85abf9cd729c5b65f1ebd0ccf9de90b270cd61935eef0197f", + "sha256:1452241c290f3e2a312c137a9999cdbf63f78864d63c79039bda65ee86943f61", + "sha256:222e40d0e2548690405b0b3c7b21d1169117391c2e82c378467ef9ab4c8f0da7", + "sha256:2541312fbf09977f3b3ad449c4e5f4bb55d0dbf79226d7724211acc905049400", + "sha256:31f13e25b4e304632a4619d0e0777662c2ffea99fcae2029556b17d8ff958aef", + "sha256:4602244f345453db537be5314d3983dbf5834a9701b7723ec28923e2889e0bb2", + "sha256:4979217d7de511a8d57f4b4b5b2b965f707768440c17cb70fbf254c4b225238d", + "sha256:4c21decb6ea94057331e111a5bed9a79d335658c27ce2adb580fb4d54f2ad9bc", + "sha256:6620c0acd41dbcb368610bb2f4d83145674040025e5536954782467100aa8835", + "sha256:692f2e0f55794943c5bfff12b3f56f99af76f902fc47487bdfe97856de51a706", + "sha256:7215847ce88a85ce39baf9e89070cb860c98fdddacbaa6c0da3ffb31b3350bd5", + "sha256:79fc682a374c4a8ed08b331bef9c5f582585d1048fa6d80bc6c35bc384eee9b4", + "sha256:7ffe43c74893dbf38c2b0a1f5428760a1a9c98285553c89e12d70a96a7f3a4d6", + "sha256:80f5e3a4e498641401868df4208b74581206afbee7cf7b8329daae82676d9463", + "sha256:95f7ac6540e95bc440ad77f56e520da5bf877f87dca58bd095288dce8940532a", + "sha256:9667575fb6d13c95f1b36aca12c5ee3356bf001b714fc354eb5465ce1609e62f", + "sha256:a5425b114831d1e77e4b5d812b69d11d962e104095a5b9c3b641a218abcc050e", + "sha256:b4bea75e47d9586d31e892a7401f76e909712a0fd510f58f5337bea9572c571e", + "sha256:b7b1fc9864d7d39e28f41d089bfd6353cb5f27ecd9905348c24187a768c79694", + "sha256:befe2bf740fd8373cf56149a5c23a0f601e82869598d41f8e188a0e9869926f8", + "sha256:c0bfb52d2169d58c1cdb8cc1f16989101639b34c7d3ce60ed70b19c63eba0b64", + "sha256:d11efb4dbecbdf22508d55e48d9c8384db795e1b7b51ea735289ff96613ff74d", + "sha256:dd80e219fd4c71fc3699fc1dadac5dcf4fd882bfc6f7ec53d30fa197b8ee22dc", + "sha256:e2926dac25b313635e4d6cf4dc4e51c8c0ebfed60b801c799ffc4c32bf3d1254", + "sha256:e98f220aa76ca2a977fe435f5b04d7b3470c0a2e6312907b37ba6068f26787f2", + "sha256:ed094d4f0c177b1b8e7aa9cba7d6ceed51c0e569a5318ac0ca9a090680a6a1b1", + "sha256:f136bab9c2cfd8da131132c2cf6cc27331dd6fae65f95f69dcd4ae3c3639c810", + "sha256:f3a86ed21e4f87050382c7bc96571755193c4c1392490744ac73d660e8f564a9" + ], + "markers": "python_version >= '3.8'", + "version": "==1.24.4" + }, "openai": { "hashes": [ - "sha256:417b78c4c2864ba696aedaf1ccff77be1f04a581ab1739f0a56e0aae19e5a794", - "sha256:d207ece78469be5648eb87b825753282225155a29d0eec6e02013ddbf8c31c0c" + "sha256:4be1dad329a65b4ce1a660fe6d5431b438f429b5855c883435f0f7fcb6d2dcc8", + "sha256:d18690f9e3d31eedb66b57b88c2165d760b24ea0a01f150dd3f068155088ce68" ], "index": "pypi", - "version": "==0.28.0" + "markers": "python_full_version >= '3.7.1'", + "version": "==0.28.1" }, "packageurl-python": { "hashes": [ @@ -891,6 +950,7 @@ "sha256:799acfe8d9e6e3534bbc19660be97d5b66754bc033e62c39f1e2f16323fcfa84" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==0.11.2" }, "packaging": { @@ -899,6 +959,7 @@ "sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==23.1" }, "pkgutil-resolve-name": { @@ -918,11 +979,11 @@ }, "policy-sentry": { "hashes": [ - "sha256:9c59a0c8d34b456202c96342ee38cc34f87176219e6b8aa212d385122b526867", - "sha256:f54b9286fb7095a45890f315738558ff5648b934a26e6fb227b30ff9aab2bbda" + "sha256:5a09f845c9c7b8afe0e14778d3b53039bcf63e1c1a42b276eb198756dbcb9ad6", + "sha256:b8cf00a11a2a335d2bceba5dc1998182288a4b7848916a77923a6a2e0bc84373" ], "markers": "python_version >= '3.6'", - "version": "==0.12.9" + "version": "==0.12.10" }, "policyuniverse": { "hashes": [ @@ -930,6 +991,7 @@ "sha256:7920896195af163230635f1a5cee0958f56003ef8c421f805ec81f134f80a57c" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==1.5.1.20230817" }, "prettytable": { @@ -938,6 +1000,7 @@ "sha256:f4ed94803c23073a90620b201965e5dc0bccf1760b7a7eaf3158cab8aaffdf34" ], "index": "pypi", + "markers": "python_version >= '3.8'", "version": "==3.9.0" }, "pycares": { @@ -1003,6 +1066,7 @@ "sha256:a3edd1c3d280c283d614c865a854a693daf56c35cd4095b373016c214baa76dd" ], "index": "pypi", + "markers": "python_version >= '3.7' and python_version < '4.0'", "version": "==0.4.1" }, "pycparser": { @@ -1069,7 +1133,7 @@ "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86", "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'", "version": "==2.8.2" }, "pyyaml": { @@ -1126,6 +1190,7 @@ "sha256:fd66fc5d0da6d9815ba2cebeb4205f95818ff4b79c3ebe268e75d961704af52f" ], "index": "pypi", + "markers": "python_version >= '3.6'", "version": "==6.0.1" }, "rdflib": { @@ -1244,6 +1309,7 @@ "sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==2.31.0" }, "rpds-py": { @@ -1349,6 +1415,54 @@ "markers": "python_version >= '3.8'", "version": "==0.10.3" }, + "rustworkx": { + "hashes": [ + "sha256:030203b24c5742e3f3425266cc7d12f82223d97900a5beacdcd18c35383df318", + "sha256:0847a4464902f8154c8cb89ed5ebcc4a49542b004cfc71eeb4ed0b1e0547d10c", + "sha256:0b3a09b78bd4ac589c5e2f0413c777e7dec94c704e47e39fa5a1737f7c31715d", + "sha256:115e892dd5a38f0a9b81e188cef64136e59734cb27b5e27dcd677d0491829425", + "sha256:156ea240f3a5f6d80dd23d198162ad997359da11b80257aa36fcd891889edfcf", + "sha256:1ac7aa312779d913f4f8159fdc9b7d31eca7667afa4a20c0bebb97d5e06be703", + "sha256:1f6828ec18d47d0e435492aef2825739f68afecf1f8686ddee8b4c88c5fd3af0", + "sha256:1fc94714c3738bde40c772c82c3efa8c8bdf0dac711fe8bb3cf2306839d97ec1", + "sha256:40784246b0176f1b6a3ff74914f849dccfefee5213ab41c020abe1f8ded488b8", + "sha256:42ad8c94ede16c8a325d661ebee7dacef11f409a2bcb5125840ebe80d9629c36", + "sha256:48e9a1d05e9909b7a5fb0dac2324b0fb621222e4b0a830b7ed30f1c0001ec39e", + "sha256:4b152061872053edea38ad543b582d071cf09cc494d4b15f5310874b905179cf", + "sha256:4b3570369bf90b76dd1ac87c077aecc9ca7e9c7d8083d658c12f98acbb94d6a3", + "sha256:5207507bbebc034006c117cf568009eb18ebe1b47ef550d77781fccb5f089a97", + "sha256:58990e9596c02643941c940a20be99013defcc05dac2eb4ae21cc2f7b3143832", + "sha256:5f978007be9c10c211985d2abb680c019d99cb23c46c56d2712968c1c4dabb0d", + "sha256:64fee8e7d25d1648d1bdcb25907539c6c9d2e5ec7f22ed76f8c9dd9b6479ffa1", + "sha256:689cc3476f27b57fd4cc8f47140410496b811eab0325fd30b21721772e6e5e4f", + "sha256:6a4008cccf2efe9441322b95fdd503ace77798c14515fa97a8920a426c5d1015", + "sha256:6c910ccd1e7ca7fa2d60436122e2a0f0a4f23a32a1c56e05b6a850741b6e3ac6", + "sha256:7acab7603e9c14f2207c3de4efb62bfeddcb4780c5cf037aac374b209d3b85cb", + "sha256:7b33861d68807eeef1d188eb05540be878bb8b67bab74d74243e0bcbe2c0a54a", + "sha256:86fc5db9da1c1d2748442b533a3eeaa55b672127a04f2a339436a12c056ccc52", + "sha256:87b54064cbd1a778ea8101c5713a1175cbfcbf694fba28b05c1339267a54be4b", + "sha256:87c6e77ffe565bd7a00d12814e2212dcbcd519d21539005d68f94e199d1fed0a", + "sha256:87cfa52047f77d5cb31c6e8537800bcc95f817e6481fe73fbd2db9643b896ab7", + "sha256:8bf3f636ffba33832f73dbb5937cfad37113a38b8c169be15e9d54c396fc33a8", + "sha256:97f0f6ad00374a21b2597ec0861aea6b5ae93f9464b74e34521a09516a6b13df", + "sha256:a1513124d021e91d965ebf09e30e2ddae47abcc785a72944522fd02db835edce", + "sha256:a1cf5894a8a03e431d106d174052feb37b45514e7a9c9300cc1ec95cf42d7acd", + "sha256:a2436e9b67a77ef88d024437de4c36477ac7c60c1c9a4244108d5af54b55688b", + "sha256:a61504a383afc112c2e137607dd519b204e74b3f7d1f31dc6e1230a23faee42a", + "sha256:ab0dd3ca9b450c3151258fb3c914841e2d72d3413628c19ceb3471a29581b483", + "sha256:ae06d002c3a52eae507517527735d6b23b222c66fbc6fc085481565e59c84291", + "sha256:b3f4b7ee14d206f6a899f82fd5e719b6fb0fdb5862133446939c63dc2a72b498", + "sha256:d1e69b0c33130a64b4fe062239ba8908720a202775642bc0bce80878016bbd28", + "sha256:da43ac860de5cebe464f3c8e4ee5e5d1665907299df36f6da22078419157c03a", + "sha256:dad268861aaddf93ad453ce88af153f3c3e622cc8ec6899fb167e1a5f8835b9c", + "sha256:e76c67896030c9edd9823c2937ac6bfa1ce58bae580a8214596b687b6011a487", + "sha256:ecf19818eb71ce2ce15044164fdd4c03d952a2ad05a38ca2df06c90fc35cf1f9", + "sha256:f2d968ba9da4cbf343ff7aee80a7e97e0d127fa0d5d4a2f456b86bfd3c324d58" + ], + "index": "pypi", + "markers": "python_version >= '3.7'", + "version": "==0.13.1" + }, "s3transfer": { "hashes": [ "sha256:b014be3a8a2aab98cfe1abc7229cc5a9a0cf05eb9c1f2b86b230fd8df3f78084", @@ -1371,6 +1485,7 @@ "sha256:de78a3b8e0feda74cabc54aab2da702113e33ac9d9eb9d2389bcf1f58b7d9177" ], "index": "pypi", + "markers": "python_version >= '2.7'", "version": "==2.10.0" }, "setuptools": { @@ -1386,16 +1501,16 @@ "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926", "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'", "version": "==1.16.0" }, "smmap": { "hashes": [ - "sha256:2aba19d6a040e78d8b09de5c57e96207b09ed71d8e55ce0959eeee6c8e190d94", - "sha256:c840e62059cd3be204b0c9c9f74be2c09d5648eddd4580d9314c3ecde0b30936" + "sha256:dceeb6c0028fdb6734471eb07c0cd2aae706ccaecab45965ee83f11c8d3b1f62", + "sha256:e6d8668fa5f93e706934a62d7b4db19c8d9eb8cf2adbb75ef1b675aa332b69da" ], - "markers": "python_version >= '3.6'", - "version": "==5.0.0" + "markers": "python_version >= '3.7'", + "version": "==5.0.1" }, "sortedcontainers": { "hashes": [ @@ -1418,6 +1533,7 @@ "sha256:c83652cd65b5726058dcbdaab85839dbe484c43ea6f61046137516aa1b8428ae" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==0.8.1" }, "tabulate": { @@ -1426,6 +1542,7 @@ "sha256:024ca478df22e9340661486f85298cff5f6dcdba14f3813e8830015b9ed1948f" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==0.9.0" }, "termcolor": { @@ -1434,6 +1551,7 @@ "sha256:b5b08f68937f138fe92f6c089b99f1e2da0ae56c52b78bf7075fd95420fd9a5a" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==2.3.0" }, "texttable": { @@ -1448,7 +1566,7 @@ "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b", "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f" ], - "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'", "version": "==0.10.2" }, "tqdm": { @@ -1457,15 +1575,17 @@ "sha256:d88e651f9db8d8551a62556d3cff9e3034274ca5d66e93197cf2490e2dcb69c7" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==4.66.1" }, "typing-extensions": { "hashes": [ - "sha256:440d5dd3af93b060174bf433bccd69b0babc3b15b1a8dca43789fd7f61514b36", - "sha256:b75ddc264f0ba5615db7ba217daeb99701ad295353c45f9e95963337ceeeffb2" + "sha256:8f92fc8806f9a6b641eaa5318da32b44d401efaac0f6678c9bc448ba3605faa0", + "sha256:df8e4339e9cb77357558cbdbceca33c303714cf861d1eef15e1070055ae8b7ef" ], "index": "pypi", - "version": "==4.7.1" + "markers": "python_version >= '3.8'", + "version": "==4.8.0" }, "unidiff": { "hashes": [ @@ -1599,15 +1719,16 @@ "sha256:f7a3d8146575e08c29ed1cd287068e6d02f1c7bdff8970db96683b9591b86ee7" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==1.9.2" }, "zipp": { "hashes": [ - "sha256:679e51dd4403591b2d6838a48de3d283f3d188412a9782faadf845f298736ba0", - "sha256:ebc15946aa78bd63458992fc81ec3b6f7b1e92d51c35e6de1c3804e73b799147" + "sha256:0e923e726174922dce09c53c59ad483ff7bbb8e572e00c7f7c46b88556409f31", + "sha256:84e64a1c28cf7e91ed2078bb8cc8c259cb19b76942096c8d7b84947690cabaf0" ], "markers": "python_version >= '3.8'", - "version": "==3.16.2" + "version": "==3.17.0" } }, "develop": { @@ -1702,6 +1823,7 @@ "sha256:fd1ed388ea7fbed22c4968dd64bab0198de60750a25fe8c0c9d4bef5abe13824" ], "index": "pypi", + "markers": "python_version >= '3.6'", "version": "==3.8.5" }, "aioresponses": { @@ -1742,6 +1864,7 @@ "sha256:bdfc739baa03b880c2d15d0431b31c658ffc348e907fe197e54e0389dd59e11e" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==1.7.5" }, "boto3-stubs-lite": { @@ -1749,19 +1872,19 @@ "s3" ], "hashes": [ - "sha256:348deff669e69421779d98d3f543fa724459ea818db48e19362012c43a40e192", - "sha256:cb69a4903742bbec3c66daa8cd8803844a8b43a99e09f1d71f0b9278d5a62ced" + "sha256:3894e31ea93b30d1798e0cb79a7471b42ea721396daed2a5a7ba4cd6304dee1b", + "sha256:f015f3ad7457647835999d069198ed7610942c6e38865d763301e872ee84e9f5" ], - "index": "pypi", - "version": "==1.28.49" + "markers": "python_version >= '3.7'", + "version": "==1.28.54" }, "botocore-stubs": { "hashes": [ - "sha256:2e005b032feeba93f74511027338a6266b4d7f582e31a56a67ac728a3b5f5b83", - "sha256:4807bbb65680ff4546d60a76879d83af6d314d0952413d347a8c784eef37c482" + "sha256:6e3e015ba4d2172c6a9bd5ff5131c39c995991559a567dce6c8534884f83ded1", + "sha256:96223fdf87a68037dd1ed366ffe28b5b744aca495a365f4535e2179c9a88455c" ], "markers": "python_version >= '3.7' and python_version < '4.0'", - "version": "==1.31.49" + "version": "==1.31.54" }, "certifi": { "hashes": [ @@ -1858,6 +1981,7 @@ "sha256:f87f746ee241d30d6ed93969de31e5ffd09a2961a051e60ae6bddde9ec3583aa" ], "index": "pypi", + "markers": "python_full_version >= '3.7.0'", "version": "==3.2.0" }, "coverage": { @@ -1916,6 +2040,7 @@ "sha256:f11642dddbb0253cc8853254301b51390ba0081750a8ac03f20ea8103f0c56b6" ], "index": "pypi", + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'", "version": "==5.5" }, "coverage-badge": { @@ -1970,6 +2095,7 @@ "sha256:ffdfce58ea94c6580c77888a86506937f9a1a227dfcd15f245d694ae20a6b6e5" ], "index": "pypi", + "markers": "python_full_version >= '3.8.1'", "version": "==6.1.0" }, "flake8-bugbear": { @@ -1978,6 +2104,7 @@ "sha256:b182cf96ea8f7a8595b2f87321d7d9b28728f4d9c3318012d896543d19742cb5" ], "index": "pypi", + "markers": "python_full_version >= '3.8.1'", "version": "==23.9.16" }, "freezegun": { @@ -1986,6 +2113,7 @@ "sha256:ea1b963b993cb9ea195adbd893a48d573fda951b0da64f60883d7e988b606c9f" ], "index": "pypi", + "markers": "python_version >= '3.6'", "version": "==1.2.2" }, "frozenlist": { @@ -2065,11 +2193,12 @@ }, "gitpython": { "hashes": [ - "sha256:4bb0c2a6995e85064140d31a33289aa5dce80133a23d36fcd372d716c54d3ebf", - "sha256:8d22b5cfefd17c79914226982bb7851d6ade47545b1735a9d010a2a4c26d8388" + "sha256:5f4c4187de49616d710a77e98ddf17b4782060a1788df441846bddefbb89ab33", + "sha256:f9b9ddc0761c125d5780eab2d64be4873fc6817c2899cbcb34b02344bdc7bc54" ], "index": "pypi", - "version": "==3.1.36" + "markers": "python_version >= '3.7'", + "version": "==3.1.37" }, "identify": { "hashes": [ @@ -2089,11 +2218,11 @@ }, "importlib-resources": { "hashes": [ - "sha256:134832a506243891221b88b4ae1213327eea96ceb4e407a00d790bb0626f45cf", - "sha256:4359457e42708462b9626a04657c6208ad799ceb41e5c58c57ffa0e6a098a5d4" + "sha256:9d48dcccc213325e810fd723e7fbb45ccb39f6cf5c31f00cf2b965f5f10f3cb9", + "sha256:aa50258bbfa56d4e33fbd8aa3ef48ded10d1735f11532b8df95388cc6bdb7e83" ], "markers": "python_version < '3.9'", - "version": "==6.0.1" + "version": "==6.1.0" }, "iniconfig": { "hashes": [ @@ -2105,11 +2234,12 @@ }, "jsonschema": { "hashes": [ - "sha256:043dc26a3845ff09d20e4420d6012a9c91c9aa8999fa184e7efcfeccb41e32cb", - "sha256:6e1e7569ac13be8139b2dd2c21a55d350066ee3f80df06c608b398cdc6f30e8f" + "sha256:cd5f1f9ed9444e554b38ba003af06c0a8c2868131e56bfbef0550fb450c0330e", + "sha256:ec84cc37cfa703ef7cd4928db24f9cb31428a5d0fa77747b8b51a847458e0bbf" ], "index": "pypi", - "version": "==4.19.0" + "markers": "python_version >= '3.8'", + "version": "==4.19.1" }, "jsonschema-specifications": { "hashes": [ @@ -2149,6 +2279,7 @@ "sha256:5e96aad5ccda4718e0a229ed94b2024df75cc2d55575ba5762d31f5767b8767d" ], "index": "pypi", + "markers": "python_version >= '3.6'", "version": "==5.1.0" }, "multidict": { @@ -2262,14 +2393,15 @@ "sha256:ff0cedc84184115202475bbb46dd99f8dcb87fe24d5d0ddfc0fe6b8575c88d2f" ], "index": "pypi", + "markers": "python_version >= '3.8'", "version": "==1.5.1" }, "mypy-boto3-s3": { "hashes": [ - "sha256:44da375fd4d75b1c5ccc26dcd3be48294c7061445efd6d90ebfca43ffebbb3e4", - "sha256:d0e90074e4043edf420292397012e37309ff204442a0874d8c969f56546be665" + "sha256:179cb7542cc5ef656f1323ad51eb237afcba77d1e5ed07d21a013fe36effb8b2", + "sha256:a75cd5ff28f1cb5109dd50db94259436701208fa97c61b5a2cc0689e169b7cba" ], - "version": "==1.28.36" + "version": "==1.28.52" }, "mypy-extensions": { "hashes": [ @@ -2293,6 +2425,7 @@ "sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==23.1" }, "parameterized": { @@ -2301,6 +2434,7 @@ "sha256:7fc905272cefa4f364c1a3429cbbe9c0f98b793988efb5bf90aac80f08db09b1" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==0.9.0" }, "pbr": { @@ -2341,6 +2475,7 @@ "sha256:96d529a951f8b677f730a7212442027e8ba53f9b04d217c4c67dc56c393ad945" ], "index": "pypi", + "markers": "python_version >= '3.8'", "version": "==3.4.0" }, "pycodestyle": { @@ -2373,6 +2508,7 @@ "sha256:a766259cfab564a2ad52cb1aae1b881a75c3eb7e34ca3779697c23ed47c47069" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==7.4.2" }, "pytest-asyncio": { @@ -2381,6 +2517,7 @@ "sha256:8666c1c8ac02631d7c51ba282e0c69a8a452b211ffedf2599099845da5c5c37b" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==0.21.1" }, "pytest-cov": { @@ -2389,6 +2526,7 @@ "sha256:6ba70b9e97e69fcc3fb45bfeab2d0a138fb65c4d0d6a41ef33983ad114be8c3a" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==4.1.0" }, "pytest-mock": { @@ -2397,6 +2535,7 @@ "sha256:7f6b125602ac6d743e523ae0bfa71e1a697a2f5534064528c6ff84c2f7c2fc7f" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==3.11.1" }, "pytest-xdist": { @@ -2405,6 +2544,7 @@ "sha256:ff9daa7793569e6a68544850fd3927cd257cc03a7ef76c95e86915355e82b5f2" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==3.3.1" }, "python-dateutil": { @@ -2412,7 +2552,7 @@ "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86", "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'", "version": "==2.8.2" }, "pyyaml": { @@ -2469,6 +2609,7 @@ "sha256:fd66fc5d0da6d9815ba2cebeb4205f95818ff4b79c3ebe268e75d961704af52f" ], "index": "pypi", + "markers": "python_version >= '3.6'", "version": "==6.0.1" }, "referencing": { @@ -2485,6 +2626,7 @@ "sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==2.31.0" }, "responses": { @@ -2493,15 +2635,16 @@ "sha256:e6fbcf5d82172fecc0aa1860fd91e58cbfd96cee5e96da5b63fa6eb3caa10dd3" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==0.23.3" }, "rich": { "hashes": [ - "sha256:146a90b3b6b47cac4a73c12866a499e9817426423f57c5a66949c086191a8808", - "sha256:fb9d6c0a0f643c99eed3875b5377a184132ba9be4d61516a55273d3554d75a39" + "sha256:87b43e0543149efa1253f485cd845bb7ee54df16c9617b8a893650ab84b4acb6", + "sha256:9257b468badc3d347e146a4faa268ff229039d4c2d176ab0cffb4c4fbc73d5d9" ], "markers": "python_full_version >= '3.7.0'", - "version": "==13.5.2" + "version": "==13.5.3" }, "rpds-py": { "hashes": [ @@ -2619,16 +2762,16 @@ "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926", "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'", "version": "==1.16.0" }, "smmap": { "hashes": [ - "sha256:2aba19d6a040e78d8b09de5c57e96207b09ed71d8e55ce0959eeee6c8e190d94", - "sha256:c840e62059cd3be204b0c9c9f74be2c09d5648eddd4580d9314c3ecde0b30936" + "sha256:dceeb6c0028fdb6734471eb07c0cd2aae706ccaecab45965ee83f11c8d3b1f62", + "sha256:e6d8668fa5f93e706934a62d7b4db19c8d9eb8cf2adbb75ef1b675aa332b69da" ], - "markers": "python_version >= '3.6'", - "version": "==5.0.0" + "markers": "python_version >= '3.7'", + "version": "==5.0.1" }, "stevedore": { "hashes": [ @@ -2643,7 +2786,7 @@ "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b", "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f" ], - "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'", "version": "==0.10.2" }, "tomli": { @@ -2696,19 +2839,19 @@ }, "types-pyyaml": { "hashes": [ - "sha256:7d340b19ca28cddfdba438ee638cd4084bde213e501a3978738543e27094775b", - "sha256:a461508f3096d1d5810ec5ab95d7eeecb651f3a15b71959999988942063bf01d" + "sha256:334373d392fde0fdf95af5c3f1661885fa10c52167b14593eb856289e1855062", + "sha256:c05bc6c158facb0676674b7f11fe3960db4f389718e19e62bd2b84d6205cfd24" ], "index": "pypi", - "version": "==6.0.12.11" + "version": "==6.0.12.12" }, "types-requests": { "hashes": [ - "sha256:56d181c85b5925cbc59f4489a57e72a8b2166f18273fd8ba7b6fe0c0b986f12a", - "sha256:6aa3f7faf0ea52d728bb18c0a0d1522d9bfd8c72d26ff6f61bfc3d06a411cf40" + "sha256:e2523825754b2832e04cdc1e731423390e731457890113a201ebca8ad9b40427", + "sha256:e4153c2a4e48dcc661600fa5f199b483cdcbd21965de0b5e2df26e93343c0f57" ], "index": "pypi", - "version": "==2.31.0.2" + "version": "==2.31.0.5" }, "types-s3transfer": { "hashes": [ @@ -2744,11 +2887,12 @@ }, "typing-extensions": { "hashes": [ - "sha256:440d5dd3af93b060174bf433bccd69b0babc3b15b1a8dca43789fd7f61514b36", - "sha256:b75ddc264f0ba5615db7ba217daeb99701ad295353c45f9e95963337ceeeffb2" + "sha256:8f92fc8806f9a6b641eaa5318da32b44d401efaac0f6678c9bc448ba3605faa0", + "sha256:df8e4339e9cb77357558cbdbceca33c303714cf861d1eef15e1070055ae8b7ef" ], "index": "pypi", - "version": "==4.7.1" + "markers": "python_version >= '3.8'", + "version": "==4.8.0" }, "urllib3": { "hashes": [ @@ -2852,15 +2996,16 @@ "sha256:f7a3d8146575e08c29ed1cd287068e6d02f1c7bdff8970db96683b9591b86ee7" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==1.9.2" }, "zipp": { "hashes": [ - "sha256:679e51dd4403591b2d6838a48de3d283f3d188412a9782faadf845f298736ba0", - "sha256:ebc15946aa78bd63458992fc81ec3b6f7b1e92d51c35e6de1c3804e73b799147" + "sha256:0e923e726174922dce09c53c59ad483ff7bbb8e572e00c7f7c46b88556409f31", + "sha256:84e64a1c28cf7e91ed2078bb8cc8c259cb19b76942096c8d7b84947690cabaf0" ], "markers": "python_version >= '3.8'", - "version": "==3.16.2" + "version": "==3.17.0" } } } diff --git a/checkov/common/bridgecrew/wrapper.py b/checkov/common/bridgecrew/wrapper.py index 17dde199b96..8b279c3cb4b 100644 --- a/checkov/common/bridgecrew/wrapper.py +++ b/checkov/common/bridgecrew/wrapper.py @@ -11,6 +11,7 @@ import dpath from igraph import Graph +from rustworkx import PyDiGraph, digraph_node_link_json # type: ignore try: from networkx import DiGraph, node_link_data @@ -19,6 +20,7 @@ DiGraph = str node_link_data = lambda G : {} + from checkov.common.bridgecrew.check_type import CheckType from checkov.common.models.consts import SUPPORTED_FILE_EXTENSIONS from checkov.common.typing import _ReducedScanReport @@ -38,6 +40,10 @@ secrets_check_reduced_keys = check_reduced_keys + ('validation_status',) check_metadata_keys = ('evaluations', 'code_block', 'workflow_name', 'triggers', 'job') +FILE_NAME_NETWORKX = 'graph_networkx.json' +FILE_NAME_IGRAPH = 'graph_igraph.json' +FILE_NAME_RUSTWORKX = 'graph_rustworkx.json' + def _is_scanned_file(file: str) -> bool: file_ending = os.path.splitext(file)[1] @@ -146,15 +152,24 @@ def enrich_and_persist_checks_metadata( return checks_metadata_paths -def persist_graphs(graphs: dict[str, DiGraph | Graph], s3_client: S3Client, bucket: str, full_repo_object_key: str, - timeout: int, absolute_root_folder: str = '') -> None: +def persist_graphs( + graphs: dict[str, DiGraph | Graph | PyDiGraph[Any, Any]], + s3_client: S3Client, + bucket: str, + full_repo_object_key: str, + timeout: int, + absolute_root_folder: str = '', +) -> None: def _upload_graph(check_type: str, graph: DiGraph | Graph, _absolute_root_folder: str = '') -> None: if isinstance(graph, DiGraph): json_obj = node_link_data(graph) - graph_file_name = 'graph_networkx.json' + graph_file_name = FILE_NAME_NETWORKX elif isinstance(graph, Graph): json_obj = serialize_to_json(graph, _absolute_root_folder) - graph_file_name = 'graph_igraph.json' + graph_file_name = FILE_NAME_IGRAPH + elif isinstance(graph, PyDiGraph): + json_obj = digraph_node_link_json(graph) + graph_file_name = FILE_NAME_RUSTWORKX else: logging.error(f"unsupported graph type '{graph.__class__.__name__}'") return diff --git a/checkov/common/checks_infra/solvers/attribute_solvers/base_attribute_solver.py b/checkov/common/checks_infra/solvers/attribute_solvers/base_attribute_solver.py index 46366133c16..637d24a2718 100644 --- a/checkov/common/checks_infra/solvers/attribute_solvers/base_attribute_solver.py +++ b/checkov/common/checks_infra/solvers/attribute_solvers/base_attribute_solver.py @@ -8,6 +8,7 @@ from igraph import Graph from bc_jsonpath_ng.ext import parse +from networkx import DiGraph from checkov.common.graph.checks_infra import debug from checkov.common.graph.checks_infra.enums import SolverType @@ -65,8 +66,17 @@ def run(self, graph_connector: LibraryGraph) -> Tuple[List[Dict[str, Any]], List failed_vertices.append(data) return passed_vertices, failed_vertices, unknown_vertices + elif isinstance(graph_connector, DiGraph): + for _, data in graph_connector.nodes(data=True): + if (not self.resource_types or data.get(CustomAttributes.RESOURCE_TYPE) in self.resource_types) \ + and data.get(CustomAttributes.BLOCK_TYPE) in SUPPORTED_BLOCK_TYPES: + jobs.append(executer.submit( + self._process_node, data, passed_vertices, failed_vertices, unknown_vertices)) + + concurrent.futures.wait(jobs) + return passed_vertices, failed_vertices, unknown_vertices - for _, data in graph_connector.nodes(data=True): + for _, data in graph_connector.nodes(): if (not self.resource_types or data.get(CustomAttributes.RESOURCE_TYPE) in self.resource_types) \ and data.get(CustomAttributes.BLOCK_TYPE) in SUPPORTED_BLOCK_TYPES: jobs.append(executer.submit( diff --git a/checkov/common/checks_infra/solvers/complex_solvers/base_complex_solver.py b/checkov/common/checks_infra/solvers/complex_solvers/base_complex_solver.py index a98cccbfe8d..92a4e049191 100644 --- a/checkov/common/checks_infra/solvers/complex_solvers/base_complex_solver.py +++ b/checkov/common/checks_infra/solvers/complex_solvers/base_complex_solver.py @@ -4,6 +4,7 @@ from typing import List, Any, Tuple, Dict, TYPE_CHECKING, Optional from igraph import Graph +from networkx import DiGraph from checkov.common.graph.checks_infra import debug from checkov.common.graph.checks_infra.enums import SolverType @@ -59,8 +60,19 @@ def run(self, graph_connector: LibraryGraph) -> Tuple[List[Dict[str, Any]], List ) return passed_vertices, failed_vertices, unknown_vertices + elif isinstance(graph_connector, DiGraph): + for _, data in graph_connector.nodes(data=True): + if self.resource_type_pred(data, self.resource_types): + result = self.get_operation(data) + if result is None: + unknown_vertices.append(data) + elif result: + passed_vertices.append(data) + else: + failed_vertices.append(data) + return passed_vertices, failed_vertices, unknown_vertices - for _, data in graph_connector.nodes(data=True): + for _, data in graph_connector.nodes(): if self.resource_type_pred(data, self.resource_types): result = self.get_operation(data) if result is None: diff --git a/checkov/common/checks_infra/solvers/connections_solvers/base_connection_solver.py b/checkov/common/checks_infra/solvers/connections_solvers/base_connection_solver.py index 2b43310af98..cd6508a6108 100644 --- a/checkov/common/checks_infra/solvers/connections_solvers/base_connection_solver.py +++ b/checkov/common/checks_infra/solvers/connections_solvers/base_connection_solver.py @@ -4,6 +4,7 @@ from typing import Any, List, Dict, Optional, Tuple, TYPE_CHECKING from igraph import Graph +from networkx import DiGraph from checkov.common.graph.checks_infra.enums import SolverType from checkov.common.graph.checks_infra.solvers.base_solver import BaseSolver @@ -61,7 +62,7 @@ def set_vertices(self, graph_connector: LibraryGraph, exclude_vertices: List[Dic self.vertices_under_connected_resources_types = [ data for data in graph_connector.vs.select(resource_type_in=self.connected_resources_types)["attr"] ] - else: + elif isinstance(graph_connector, DiGraph): self.vertices_under_resource_types = [ v for _, v in graph_connector.nodes(data=True) if self.resource_type_pred(v, self.resource_types) ] @@ -69,6 +70,16 @@ def set_vertices(self, graph_connector: LibraryGraph, exclude_vertices: List[Dic v for _, v in graph_connector.nodes(data=True) if self.resource_type_pred(v, self.connected_resources_types) ] + # isinstance(graph_connector, PyDiGraph): + else: + self.vertices_under_resource_types = [ + v for _, v in graph_connector.nodes() if self.resource_type_pred(v, self.resource_types) + ] + self.vertices_under_connected_resources_types = [ + v for _, v in graph_connector.nodes() if + self.resource_type_pred(v, self.connected_resources_types) + ] + self.excluded_vertices = [ v for v in itertools.chain(self.vertices_under_resource_types, self.vertices_under_connected_resources_types) @@ -92,7 +103,7 @@ def reduce_graph_by_target_types(self, graph_connector: LibraryGraph) -> Library connection_nodes = { vertex for vertex in graph_connector.vs.select(block_type__in=BaseConnectionSolver.SUPPORTED_CONNECTION_BLOCK_TYPES) } - else: + elif isinstance(graph_connector, DiGraph): resource_nodes = { node for node, resource_type in graph_connector.nodes(data=CustomAttributes.RESOURCE_TYPE) @@ -106,9 +117,24 @@ def reduce_graph_by_target_types(self, graph_connector: LibraryGraph) -> Library if block_type in BaseConnectionSolver.SUPPORTED_CONNECTION_BLOCK_TYPES } + # isinstance(graph_connector, PyDiGraph): + else: + resource_nodes = { + index + for index, node in graph_connector.nodes() + if self.resource_type_pred(node, list(self.targeted_resources_types)) + } + + # tuple needs to be adjusted, if more connection block types are supported + connection_nodes = { + index + for index, node in graph_connector.nodes() + if node['block_type_'] in BaseConnectionSolver.SUPPORTED_CONNECTION_BLOCK_TYPES + } + resource_nodes.update(connection_nodes) - return graph_connector.subgraph(resource_nodes) + return graph_connector.subgraph(list(resource_nodes)) def populate_checks_results(self, origin_attributes: Dict[str, Any], destination_attributes: Dict[str, Any], passed: List[Dict[str, Any]], failed: List[Dict[str, Any]], unknown: List[Dict[str, Any]]) -> None: if origin_attributes in self.excluded_vertices or destination_attributes in self.excluded_vertices: diff --git a/checkov/common/checks_infra/solvers/connections_solvers/connection_exists_solver.py b/checkov/common/checks_infra/solvers/connections_solvers/connection_exists_solver.py index a0c26a02613..1cafb97a64b 100644 --- a/checkov/common/checks_infra/solvers/connections_solvers/connection_exists_solver.py +++ b/checkov/common/checks_infra/solvers/connections_solvers/connection_exists_solver.py @@ -1,13 +1,16 @@ +from __future__ import annotations + import itertools import logging from typing import List, Optional, Dict, Any, Tuple from igraph import Graph +from rustworkx import PyDiGraph from checkov.common.graph.checks_infra import debug try: - from networkx import edge_dfs + from networkx import edge_dfs, DiGraph except ImportError: logging.info("Not able to import networkx") edge_dfs = lambda G : [] @@ -63,71 +66,13 @@ def _get_operation( return passed, failed, unknown if isinstance(graph_connector, Graph): - - for root_vertex in graph_connector.vs: - inverted = False - origin_attributes = None - destination_attributes_list = [] - for vertex in graph_connector.dfsiter(root_vertex.index): - resource_type = vertex[CustomAttributes.RESOURCE_TYPE] - attributes = vertex["attr"] - if resource_type in self.resource_types and attributes in self.vertices_under_resource_types: - if not origin_attributes: - origin_attributes = attributes - elif inverted: - destination_attributes_list.append(attributes) - elif resource_type in self.connected_resources_types and attributes in self.vertices_under_connected_resources_types: - if not origin_attributes: - origin_attributes = attributes - inverted = True - else: - destination_attributes_list.append(attributes) - - if origin_attributes and destination_attributes_list: - for destination_attributes in destination_attributes_list: - self.populate_checks_results( - origin_attributes=origin_attributes, - destination_attributes=destination_attributes, - passed=passed, - failed=failed, - unknown=unknown, - ) + self.get_igraph_operation(graph_connector=graph_connector, passed=passed, failed=failed, unknown=unknown) + elif isinstance(graph_connector, DiGraph): + self.get_networkx_operation(graph_connector=graph_connector, passed=passed, failed=failed, unknown=unknown) + elif isinstance(graph_connector, PyDiGraph): + self.get_rustworkx_operation(graph_connector=graph_connector, passed=passed, failed=failed, unknown=unknown) else: - for u, v in edge_dfs(graph_connector): - origin_attributes = graph_connector.nodes(data=True)[u] - opposite_vertices = None - if origin_attributes in self.vertices_under_resource_types: - opposite_vertices = self.vertices_under_connected_resources_types - elif origin_attributes in self.vertices_under_connected_resources_types: - opposite_vertices = self.vertices_under_resource_types - if not opposite_vertices: - continue - - destination_attributes = graph_connector.nodes(data=True)[v] - if destination_attributes in opposite_vertices: - self.populate_checks_results( - origin_attributes=origin_attributes, - destination_attributes=destination_attributes, - passed=passed, - failed=failed, - unknown=unknown, - ) - destination_attributes["connected_node"] = origin_attributes - continue - - destination_block_type = destination_attributes.get(CustomAttributes.BLOCK_TYPE) - if destination_block_type == BlockType.OUTPUT: - try: - output_edges = graph_connector.edges(v, data=True) - _, output_destination, _ = next(iter(output_edges)) - output_destination = graph_connector.nodes(data=True)[output_destination] - output_destination_type = output_destination.get(CustomAttributes.RESOURCE_TYPE) - if self.is_associated_edge( - origin_attributes.get(CustomAttributes.RESOURCE_TYPE), output_destination_type - ): - passed.extend([origin_attributes, output_destination]) - except StopIteration: - continue + raise Exception(f"Graph type {type(graph_connector)} not supported") failed.extend( [ @@ -140,3 +85,132 @@ def _get_operation( ) return passed, failed, unknown + + def get_igraph_operation( + self, + graph_connector: Graph, + passed: list[dict[str, Any]], + failed: list[dict[str, Any]], + unknown: list[dict[str, Any]], + ) -> None: + for root_vertex in graph_connector.vs: + inverted = False + origin_attributes = None + destination_attributes_list = [] + for vertex in graph_connector.dfsiter(root_vertex.index): + resource_type = vertex[CustomAttributes.RESOURCE_TYPE] + attributes = vertex["attr"] + if resource_type in self.resource_types and attributes in self.vertices_under_resource_types: + if not origin_attributes: + origin_attributes = attributes + elif inverted: + destination_attributes_list.append(attributes) + elif ( + resource_type in self.connected_resources_types + and attributes in self.vertices_under_connected_resources_types + ): + if not origin_attributes: + origin_attributes = attributes + inverted = True + else: + destination_attributes_list.append(attributes) + + if origin_attributes and destination_attributes_list: + for destination_attributes in destination_attributes_list: + self.populate_checks_results( + origin_attributes=origin_attributes, + destination_attributes=destination_attributes, + passed=passed, + failed=failed, + unknown=unknown, + ) + + def get_networkx_operation( + self, + graph_connector: DiGraph, + passed: list[dict[str, Any]], + failed: list[dict[str, Any]], + unknown: list[dict[str, Any]], + ) -> None: + for u, v in edge_dfs(graph_connector): + origin_attributes = graph_connector.nodes(data=True)[u] + opposite_vertices = None + if origin_attributes in self.vertices_under_resource_types: + opposite_vertices = self.vertices_under_connected_resources_types + elif origin_attributes in self.vertices_under_connected_resources_types: + opposite_vertices = self.vertices_under_resource_types + if not opposite_vertices: + continue + + destination_attributes = graph_connector.nodes(data=True)[v] + if destination_attributes in opposite_vertices: + self.populate_checks_results( + origin_attributes=origin_attributes, + destination_attributes=destination_attributes, + passed=passed, + failed=failed, + unknown=unknown, + ) + destination_attributes["connected_node"] = origin_attributes + continue + if origin_attributes.get(CustomAttributes.BLOCK_TYPE) == BlockType.OUTPUT: + print(1) + destination_block_type = destination_attributes.get(CustomAttributes.BLOCK_TYPE) + if destination_block_type == BlockType.OUTPUT: + try: + output_edges = graph_connector.edges(v, data=True) + _, output_destination, _ = next(iter(output_edges)) + output_destination = graph_connector.nodes(data=True)[output_destination] + output_destination_type = output_destination.get(CustomAttributes.RESOURCE_TYPE) + if self.is_associated_edge( + origin_attributes.get(CustomAttributes.RESOURCE_TYPE), output_destination_type + ): + passed.extend([origin_attributes, output_destination]) + except StopIteration: + continue + + def get_rustworkx_operation( + self, + graph_connector: PyDiGraph[Any, Any], + passed: list[dict[str, Any]], + failed: list[dict[str, Any]], + unknown: list[dict[str, Any]], + ) -> None: + for edge in graph_connector.edge_list(): + u, v = edge + origin_attributes = graph_connector.nodes()[u][1] + opposite_vertices = None + if origin_attributes in self.vertices_under_resource_types: + opposite_vertices = self.vertices_under_connected_resources_types + elif origin_attributes in self.vertices_under_connected_resources_types: + opposite_vertices = self.vertices_under_resource_types + if not opposite_vertices: + continue + + destination_attributes = graph_connector.nodes()[v][1] + if destination_attributes in opposite_vertices: + self.populate_checks_results( + origin_attributes=origin_attributes, + destination_attributes=destination_attributes, + passed=passed, + failed=failed, + unknown=unknown, + ) + destination_attributes["connected_node"] = origin_attributes + continue + + destination_block_type = destination_attributes.get(CustomAttributes.BLOCK_TYPE) + if destination_block_type == BlockType.OUTPUT: + try: + output_edges = graph_connector.adj_direction( + v, False + ) # True means inbound edges and False means outbound edges + output_destination_index = next(iter(output_edges)) + output_destination = graph_connector.nodes()[output_destination_index][1] + output_destination_type = output_destination.get(CustomAttributes.RESOURCE_TYPE) + if self.is_associated_edge( + origin_attributes.get(CustomAttributes.RESOURCE_TYPE), output_destination_type + ): + passed.extend([origin_attributes, output_destination]) + except StopIteration: + continue diff --git a/checkov/common/graph/checks_infra/registry.py b/checkov/common/graph/checks_infra/registry.py index 8fec809f7a7..933f843a7bc 100644 --- a/checkov/common/graph/checks_infra/registry.py +++ b/checkov/common/graph/checks_infra/registry.py @@ -26,6 +26,7 @@ def run_checks( ) -> dict[BaseGraphCheck, list[_CheckResult]]: check_results: "dict[BaseGraphCheck, list[_CheckResult]]" = {} + checks_to_run = [c for c in self.checks if runner_filter.should_run_check(c, report_type=report_type)] with concurrent.futures.ThreadPoolExecutor() as executor: concurrent.futures.wait( diff --git a/checkov/common/graph/db_connectors/rustworkx/__init__.py b/checkov/common/graph/db_connectors/rustworkx/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/checkov/common/graph/db_connectors/rustworkx/rustworkx_db_connector.py b/checkov/common/graph/db_connectors/rustworkx/rustworkx_db_connector.py new file mode 100644 index 00000000000..c55170cb181 --- /dev/null +++ b/checkov/common/graph/db_connectors/rustworkx/rustworkx_db_connector.py @@ -0,0 +1,52 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING, TypeVar, Any # noqa + +import rustworkx as rx + +from checkov.common.graph.db_connectors.db_connector import DBConnector + +if TYPE_CHECKING: + from checkov.common.graph.graph_builder.graph_components.blocks import Block # noqa + from checkov.common.graph.graph_builder.local_graph import LocalGraph + +_Block = TypeVar("_Block", bound="Block") + + +class RustworkxConnector(DBConnector["rx.PyDiGraph[Any, Any]"]): + def __init__(self) -> None: + self.graph = rx.PyDiGraph() # type: ignore + + def save_graph(self, local_graph: LocalGraph[_Block], add_bulk_edges: bool = False) -> rx.PyDiGraph: # type: ignore + return self.rustworkx_from_local_graph(local_graph) + + def get_reader_endpoint(self) -> rx.PyDiGraph: # type: ignore + return self.graph + + def get_writer_endpoint(self) -> rx.PyDiGraph: # type: ignore + return self.graph + + def rustworkx_from_local_graph(self, local_graph: LocalGraph[_Block]) -> rx.PyDiGraph: # type: ignore + self.graph = rx.PyDiGraph() + vertices_to_add = [] + for index, vertex in enumerate(local_graph.vertices): + attr = vertex.get_attribute_dict() + vertices_to_add.append((index, attr)) + + edges_to_add = [ + ( + e.origin, + e.dest, + {"label": e.label}, + ) + for e in local_graph.edges + ] + + self.graph.add_nodes_from(vertices_to_add) + self.graph.add_edges_from(edges_to_add) + + return self.graph + + def disconnect(self) -> None: + # not used, but is an abstractmethod + return None diff --git a/checkov/common/graph/db_connectors/utils.py b/checkov/common/graph/db_connectors/utils.py new file mode 100644 index 00000000000..b33cfaaa5d6 --- /dev/null +++ b/checkov/common/graph/db_connectors/utils.py @@ -0,0 +1,15 @@ +from typing import Any + +from checkov.common.graph.db_connectors.igraph.igraph_db_connector import IgraphConnector +from checkov.common.graph.db_connectors.networkx.networkx_db_connector import NetworkxConnector +from checkov.common.graph.db_connectors.rustworkx.rustworkx_db_connector import RustworkxConnector + + +def set_db_connector_by_graph_framework(graph_framework: str) -> Any: + if graph_framework == 'NETWORKX': + return NetworkxConnector() + elif graph_framework == 'IGRAPH': + return IgraphConnector() + elif graph_framework == 'RUSTWORKX': + return RustworkxConnector() + return None diff --git a/checkov/common/runners/base_runner.py b/checkov/common/runners/base_runner.py index 65b1d082edf..3ce6de5dc5a 100644 --- a/checkov/common/runners/base_runner.py +++ b/checkov/common/runners/base_runner.py @@ -67,13 +67,16 @@ def __init__(self, file_extensions: Iterable[str] | None = None, file_names: Ite self.file_extensions = file_extensions or [] self.file_names = file_names or [] self.pbar = ProgressBar(self.check_type) - db_connector_class: "type[NetworkxConnector | IgraphConnector]" = IgraphConnector + db_connector_class: "type[NetworkxConnector | IgraphConnector | RustworkxConnector]" = IgraphConnector graph_framework = os.getenv("CHECKOV_GRAPH_FRAMEWORK", "IGRAPH") if graph_framework == "IGRAPH": db_connector_class = IgraphConnector elif graph_framework == "NETWORKX": from checkov.common.graph.db_connectors.networkx.networkx_db_connector import NetworkxConnector db_connector_class = NetworkxConnector + elif graph_framework == "RUSTWORKX": + from checkov.common.graph.db_connectors.rustworkx.rustworkx_db_connector import RustworkxConnector + db_connector_class = RustworkxConnector self.db_connector = db_connector_class() diff --git a/checkov/common/typing.py b/checkov/common/typing.py index 7ff8db1b6be..37f36f362c8 100644 --- a/checkov/common/typing.py +++ b/checkov/common/typing.py @@ -11,6 +11,7 @@ from checkov.common.runners.base_runner import BaseRunner # noqa from networkx import DiGraph from igraph import Graph + from rustworkx import PyDiGraph from checkov.terraform.modules.module_objects import TFDefinitionKey _BaseRunner = TypeVar("_BaseRunner", bound="BaseRunner[Any, Any, Any]") @@ -22,8 +23,8 @@ _Resource: TypeAlias = str _Attributes: TypeAlias = Set[str] ResourceAttributesToOmit: TypeAlias = Dict[_Resource, _Attributes] -LibraryGraph: TypeAlias = "Union[DiGraph, Graph]" -LibraryGraphConnector: TypeAlias = "Union[DBConnector[DiGraph], DBConnector[Graph]]" +LibraryGraph: TypeAlias = "Union[DiGraph, Graph, PyDiGraph]" +LibraryGraphConnector: TypeAlias = "Union[DBConnector[DiGraph], DBConnector[Graph], DBConnector[PyDiGraph]]" # TODO Remove this type and only use TFDefinitionKey TFDefinitionKeyType: TypeAlias = "Union[str, TFDefinitionKey]" diff --git a/setup.py b/setup.py index 462ea220e3a..68753055ebe 100644 --- a/setup.py +++ b/setup.py @@ -111,6 +111,7 @@ def run(self) -> None: "openai", "spdx-tools>=0.8.0,<0.9.0", "license-expression", + "rustworkx", ], dependency_links=[], # keep it empty, needed for pipenv-setup license="Apache License 2.0", diff --git a/tests/ansible/checks/graph_checks/test_yaml_policies.py b/tests/ansible/checks/graph_checks/test_yaml_policies.py index fc115cee0e6..952828f1220 100644 --- a/tests/ansible/checks/graph_checks/test_yaml_policies.py +++ b/tests/ansible/checks/graph_checks/test_yaml_policies.py @@ -6,6 +6,8 @@ from checkov.common.graph.db_connectors.networkx.networkx_db_connector import NetworkxConnector from checkov.common.graph.db_connectors.igraph.igraph_db_connector import IgraphConnector +from checkov.common.graph.db_connectors.rustworkx.rustworkx_db_connector import RustworkxConnector +from checkov.common.graph.db_connectors.utils import set_db_connector_by_graph_framework from checkov.common.graph.graph_builder import CustomAttributes from checkov.common.models.enums import CheckResult @@ -19,15 +21,12 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestYamlPolicies(TestYamlPoliciesBase): def __init__(self, args): - db_connector = None - if self.graph_framework == 'NETWORKX': - db_connector = NetworkxConnector() - elif self.graph_framework == 'IGRAPH': - db_connector = IgraphConnector() + db_connector = set_db_connector_by_graph_framework(self.graph_framework) graph_manager = ObjectGraphManager(db_connector=db_connector, source="Ansible") super().__init__( graph_manager=graph_manager, diff --git a/tests/arm/graph_builder/checks/test_yaml_policies.py b/tests/arm/graph_builder/checks/test_yaml_policies.py index a11c2de68b3..30586e9e8f8 100644 --- a/tests/arm/graph_builder/checks/test_yaml_policies.py +++ b/tests/arm/graph_builder/checks/test_yaml_policies.py @@ -6,7 +6,8 @@ from checkov.common.graph.db_connectors.networkx.networkx_db_connector import NetworkxConnector from parameterized import parameterized_class from checkov.common.graph.db_connectors.igraph.igraph_db_connector import IgraphConnector - +from checkov.common.graph.db_connectors.rustworkx.rustworkx_db_connector import RustworkxConnector +from checkov.common.graph.db_connectors.utils import set_db_connector_by_graph_framework from checkov.common.graph.graph_builder import CustomAttributes from checkov.common.models.enums import CheckResult @@ -20,15 +21,13 @@ [ {"graph_framework": "NETWORKX"}, {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"}, ] ) class TestYamlPolicies(TestYamlPoliciesBase): def __init__(self, args): - db_connector = None - if self.graph_framework == "NETWORKX": - db_connector = NetworkxConnector() - elif self.graph_framework == "IGRAPH": - db_connector = IgraphConnector() + db_connector = set_db_connector_by_graph_framework(self.graph_framework) + graph_manager = ArmGraphManager(db_connector=db_connector) super().__init__( graph_manager=graph_manager, diff --git a/tests/bicep/graph/checks/test_yaml_policies.py b/tests/bicep/graph/checks/test_yaml_policies.py index d25c9b4f27d..62ee7eb4ba0 100644 --- a/tests/bicep/graph/checks/test_yaml_policies.py +++ b/tests/bicep/graph/checks/test_yaml_policies.py @@ -6,7 +6,8 @@ from checkov.common.graph.db_connectors.networkx.networkx_db_connector import NetworkxConnector from parameterized import parameterized_class from checkov.common.graph.db_connectors.igraph.igraph_db_connector import IgraphConnector - +from checkov.common.graph.db_connectors.rustworkx.rustworkx_db_connector import RustworkxConnector +from checkov.common.graph.db_connectors.utils import set_db_connector_by_graph_framework from checkov.common.graph.graph_builder import CustomAttributes from checkov.common.models.enums import CheckResult @@ -17,15 +18,12 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestYamlPolicies(TestYamlPoliciesBase): def __init__(self, args): - db_connector = None - if self.graph_framework == 'NETWORKX': - db_connector = NetworkxConnector() - elif self.graph_framework == 'IGRAPH': - db_connector = IgraphConnector() + db_connector = set_db_connector_by_graph_framework(self.graph_framework) graph_manager = BicepGraphManager(db_connector=db_connector) super().__init__( graph_manager=graph_manager, diff --git a/tests/cloudformation/graph/checks/test_yaml_policies.py b/tests/cloudformation/graph/checks/test_yaml_policies.py index dcad260ef64..2e1e9f7305b 100644 --- a/tests/cloudformation/graph/checks/test_yaml_policies.py +++ b/tests/cloudformation/graph/checks/test_yaml_policies.py @@ -8,6 +8,8 @@ from checkov.cloudformation.graph_manager import CloudformationGraphManager from checkov.common.graph.db_connectors.igraph.igraph_db_connector import IgraphConnector from checkov.common.graph.db_connectors.networkx.networkx_db_connector import NetworkxConnector +from checkov.common.graph.db_connectors.rustworkx.rustworkx_db_connector import RustworkxConnector +from checkov.common.graph.db_connectors.utils import set_db_connector_by_graph_framework from checkov.common.graph.graph_builder import CustomAttributes from checkov.common.models.enums import CheckResult from checkov.common.output.record import Record @@ -20,15 +22,12 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestYamlPolicies(TestYamlPoliciesBase): def __init__(self, args): - db_connector = None - if self.graph_framework == 'NETWORKX': - db_connector = NetworkxConnector() - elif self.graph_framework == 'IGRAPH': - db_connector = IgraphConnector() + db_connector = set_db_connector_by_graph_framework(self.graph_framework) graph_manager = CloudformationGraphManager(db_connector=db_connector) super().__init__(graph_manager, os.path.abspath(os.path.join(file_dir, "../../../../checkov/cloudformation/checks/graph_checks")), diff --git a/tests/dockerfile/graph_builder/checks/test_yaml_policies.py b/tests/dockerfile/graph_builder/checks/test_yaml_policies.py index d641a089b7e..3b2352cd6dd 100644 --- a/tests/dockerfile/graph_builder/checks/test_yaml_policies.py +++ b/tests/dockerfile/graph_builder/checks/test_yaml_policies.py @@ -6,6 +6,8 @@ from checkov.common.graph.db_connectors.igraph.igraph_db_connector import IgraphConnector from checkov.common.graph.db_connectors.networkx.networkx_db_connector import NetworkxConnector +from checkov.common.graph.db_connectors.rustworkx.rustworkx_db_connector import RustworkxConnector +from checkov.common.graph.db_connectors.utils import set_db_connector_by_graph_framework from checkov.common.graph.graph_builder import CustomAttributes from checkov.common.models.enums import CheckResult from checkov.common.output.record import Record @@ -17,17 +19,14 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestYamlPolicies(TestYamlPoliciesBase): def __init__(self, args): - db_connector = None - if self.graph_framework == 'NETWORKX': - db_connector = NetworkxConnector - elif self.graph_framework == 'IGRAPH': - db_connector = IgraphConnector + db_connector = set_db_connector_by_graph_framework(self.graph_framework) - graph_manager = DockerfileGraphManager(db_connector=db_connector()) + graph_manager = DockerfileGraphManager(db_connector=db_connector) super().__init__( graph_manager=graph_manager, real_graph_checks_path=str( diff --git a/tests/github_actions/checks/graph_checks/test_yaml_policies.py b/tests/github_actions/checks/graph_checks/test_yaml_policies.py index 5c901ca66f3..c900dbb093f 100644 --- a/tests/github_actions/checks/graph_checks/test_yaml_policies.py +++ b/tests/github_actions/checks/graph_checks/test_yaml_policies.py @@ -6,6 +6,8 @@ from checkov.common.graph.db_connectors.igraph.igraph_db_connector import IgraphConnector from checkov.common.graph.db_connectors.networkx.networkx_db_connector import NetworkxConnector +from checkov.common.graph.db_connectors.rustworkx.rustworkx_db_connector import RustworkxConnector +from checkov.common.graph.db_connectors.utils import set_db_connector_by_graph_framework from checkov.common.graph.graph_builder import CustomAttributes from checkov.common.models.enums import CheckResult from checkov.common.output.record import Record @@ -18,15 +20,12 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestYamlPolicies(TestYamlPoliciesBase): def __init__(self, args): - db_connector = None - if self.graph_framework == 'NETWORKX': - db_connector = NetworkxConnector() - elif self.graph_framework == 'IGRAPH': - db_connector = IgraphConnector() + db_connector = set_db_connector_by_graph_framework(self.graph_framework) graph_manager = ObjectGraphManager(db_connector=db_connector, source="GitHubActions") super().__init__( diff --git a/tests/kubernetes/graph/checks/test_yaml_policies.py b/tests/kubernetes/graph/checks/test_yaml_policies.py index ae1937dabda..6454c4b31a5 100644 --- a/tests/kubernetes/graph/checks/test_yaml_policies.py +++ b/tests/kubernetes/graph/checks/test_yaml_policies.py @@ -6,6 +6,8 @@ from checkov.common.graph.db_connectors.igraph.igraph_db_connector import IgraphConnector from checkov.common.graph.db_connectors.networkx.networkx_db_connector import NetworkxConnector +from checkov.common.graph.db_connectors.rustworkx.rustworkx_db_connector import RustworkxConnector +from checkov.common.graph.db_connectors.utils import set_db_connector_by_graph_framework from checkov.common.graph.graph_builder import CustomAttributes from checkov.common.models.enums import CheckResult from checkov.common.output.record import Record @@ -16,18 +18,15 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestYamlPolicies(TestYamlPoliciesBase): def tearDown(self) -> None: self.get_checks_registry().checks = [] def __init__(self, args): - db_connector = None - if self.graph_framework == 'NETWORKX': - db_connector = NetworkxConnector() - elif self.graph_framework == 'IGRAPH': - db_connector = IgraphConnector() + db_connector = set_db_connector_by_graph_framework(self.graph_framework) graph_manager = KubernetesGraphManager(db_connector=db_connector) real_graph_checks_relative_path = "checkov/kubernetes/checks/graph_checks" real_graph_checks_path = os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/contains_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/contains_solver/test_solver.py index 1cbd63e63d6..3aac35e3a45 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/contains_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/contains_solver/test_solver.py @@ -8,7 +8,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestContainsSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/ending_with_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/ending_with_solver/test_solver.py index a2fa5511b73..d1f7c477b23 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/ending_with_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/ending_with_solver/test_solver.py @@ -7,7 +7,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestEndingWithSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/equals_ignore_case_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/equals_ignore_case_solver/test_solver.py index 40d5b7271d5..aad3dfebf2a 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/equals_ignore_case_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/equals_ignore_case_solver/test_solver.py @@ -7,7 +7,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestEqualsIgnoreCaseSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/equals_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/equals_solver/test_solver.py index 28aa9b53eb9..b7c0cc4b0f3 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/equals_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/equals_solver/test_solver.py @@ -7,7 +7,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestEqualsSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/exists_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/exists_solver/test_solver.py index 73211b87e93..ec8a0393146 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/exists_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/exists_solver/test_solver.py @@ -7,7 +7,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class ExistsSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/greater_than_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/greater_than_solver/test_solver.py index c30400303ef..7c98ac22dee 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/greater_than_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/greater_than_solver/test_solver.py @@ -14,7 +14,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestGreaterThanLessThanSolvers(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/intersects_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/intersects_solver/test_solver.py index 6323ad5e808..c0d0f109c3a 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/intersects_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/intersects_solver/test_solver.py @@ -8,7 +8,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestIntersectsSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/is_empty_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/is_empty_solver/test_solver.py index 05066ebec8c..2700ff03773 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/is_empty_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/is_empty_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestIsEmptySolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/is_false_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/is_false_solver/test_solver.py index f7c85ccba0c..b3445ebdc7b 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/is_false_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/is_false_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestIsFalse(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/is_not_empty_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/is_not_empty_solver/test_solver.py index 3b7acf466c5..d117883bf47 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/is_not_empty_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/is_not_empty_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestIsNotEmptySolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/is_true_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/is_true_solver/test_solver.py index 744fe3b37ed..89b4ffd20a0 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/is_true_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/is_true_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestIsTrue(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/jsonpath_equals_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/jsonpath_equals_solver/test_solver.py index 98a063674f7..2cc8f85b23d 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/jsonpath_equals_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/jsonpath_equals_solver/test_solver.py @@ -8,7 +8,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestJsonpathEqualsSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/jsonpath_exists_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/jsonpath_exists_solver/test_solver.py index 9b2e2148409..adcc7c3850a 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/jsonpath_exists_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/jsonpath_exists_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestJsonpathExistsSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/jsonpath_not_equals_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/jsonpath_not_equals_solver/test_solver.py index c205341778b..2fd9cf5d5c5 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/jsonpath_not_equals_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/jsonpath_not_equals_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestJsonpathNotEqualsSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/jsonpath_not_exists_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/jsonpath_not_exists_solver/test_solver.py index 3b83992ba05..94232830783 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/jsonpath_not_exists_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/jsonpath_not_exists_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestJsonpathNotExistsSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/length_equals_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/length_equals_solver/test_solver.py index 8376d5f42e5..41f95223155 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/length_equals_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/length_equals_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestLengthEquals(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/length_greater_than_or_equal_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/length_greater_than_or_equal_solver/test_solver.py index 4e5c2975a6d..783793868e7 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/length_greater_than_or_equal_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/length_greater_than_or_equal_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestLengthGreaterThanOrEqual(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/length_greater_than_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/length_greater_than_solver/test_solver.py index 627ffe89f9e..0aa0cc755d7 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/length_greater_than_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/length_greater_than_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestLengthGreaterThan(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/length_less_than_or_equal_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/length_less_than_or_equal_solver/test_solver.py index dbac232169e..f2116a9fc96 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/length_less_than_or_equal_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/length_less_than_or_equal_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestLengthLessThanOrEqual(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/length_less_than_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/length_less_than_solver/test_solver.py index 484ebf811f3..9195885a5cf 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/length_less_than_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/length_less_than_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestLengthLessThan(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/length_not_equals_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/length_not_equals_solver/test_solver.py index 5fe4a1971a4..f00fae27ca4 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/length_not_equals_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/length_not_equals_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestLengthNotEquals(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/not_contains_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/not_contains_solver/test_solver.py index 3fa9383ab97..f722bff395d 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/not_contains_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/not_contains_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestNotContainsSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/not_ending_with_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/not_ending_with_solver/test_solver.py index c138a210386..203721feec4 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/not_ending_with_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/not_ending_with_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestNotEndingWithSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/not_equals_ignore_case_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/not_equals_ignore_case_solver/test_solver.py index 0002e4ab75b..a157ea96f1d 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/not_equals_ignore_case_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/not_equals_ignore_case_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestNotEqualsIgnoreCaseSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/not_equals_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/not_equals_solver/test_solver.py index 4dcd2127d5e..179ae2767b3 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/not_equals_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/not_equals_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestNotEqualsSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/not_exists_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/not_exists_solver/test_solver.py index d14ca68b98b..91efeb67509 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/not_exists_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/not_exists_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestNotExistsSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/not_intersects_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/not_intersects_solver/test_solver.py index 39a30280603..02198f39f46 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/not_intersects_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/not_intersects_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestNotIntersectsSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/not_regex_match_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/not_regex_match_solver/test_solver.py index 7220867063c..e6181bff96d 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/not_regex_match_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/not_regex_match_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestRegexMatchSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/not_starting_with_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/not_starting_with_solver/test_solver.py index 8e0c5caca15..0d97997a992 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/not_starting_with_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/not_starting_with_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestNotStartingWithSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/not_subset_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/not_subset_solver/test_solver.py index 9e0421ef0b5..353616558d4 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/not_subset_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/not_subset_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestNotSubsetSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/not_within_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/not_within_solver/test_solver.py index 3c36f430f17..ac50349c2ff 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/not_within_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/not_within_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestNotWithinSolver(TestBaseSolver): def setUp(self) -> None: diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/number_of_words_equals_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/number_of_words_equals_solver/test_solver.py index 37825ddc404..9a75567841d 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/number_of_words_equals_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/number_of_words_equals_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestNumberOfNotWordsEquals(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/number_of_words_greater_than_or_equal_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/number_of_words_greater_than_or_equal_solver/test_solver.py index 6cc434370a6..df50445a062 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/number_of_words_greater_than_or_equal_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/number_of_words_greater_than_or_equal_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestNumberOfWordsGreaterThanOrEqual(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/number_of_words_greater_than_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/number_of_words_greater_than_solver/test_solver.py index f92c00536d6..a20a0b43292 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/number_of_words_greater_than_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/number_of_words_greater_than_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestNumberOfWordsGreaterThan(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/number_of_words_less_than_or_equal_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/number_of_words_less_than_or_equal_solver/test_solver.py index 69411780179..2bdfec5ebd9 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/number_of_words_less_than_or_equal_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/number_of_words_less_than_or_equal_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestNumberOfWordsLessThanOrEqual(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/number_of_words_less_than_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/number_of_words_less_than_solver/test_solver.py index a586e04ee2a..04936b50836 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/number_of_words_less_than_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/number_of_words_less_than_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestNumberOfWordsLessThan(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/number_of_words_not_equals_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/number_of_words_not_equals_solver/test_solver.py index 825818e6749..4959d0e4883 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/number_of_words_not_equals_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/number_of_words_not_equals_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestNumberOfWordsEquals(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/range_includes_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/range_includes_solver/test_solver.py index ce3953dbe5a..637b2c6ee3f 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/range_includes_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/range_includes_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestRangeIncludesSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/range_not_includes_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/range_not_includes_solver/test_solver.py index f5a2bcf0cf3..ed4a4a60ea8 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/range_not_includes_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/range_not_includes_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestRangeNotIncludesSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/regex_match_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/regex_match_solver/test_solver.py index c5187a452bb..d42fd3a8dff 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/regex_match_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/regex_match_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestRegexMatchSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/starting_with_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/starting_with_solver/test_solver.py index 461cc740c6e..f2d4228060c 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/starting_with_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/starting_with_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestStartingWithSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/subset_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/subset_solver/test_solver.py index 64fced43e83..5ba0e904335 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/subset_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/subset_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestSubsetSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/attribute_solvers/within_solver/test_solver.py b/tests/terraform/graph/checks_infra/attribute_solvers/within_solver/test_solver.py index 33a476c5bdf..fdcee5439e3 100644 --- a/tests/terraform/graph/checks_infra/attribute_solvers/within_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/attribute_solvers/within_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestWithinSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/complex_solvers/and_solver/test_solver.py b/tests/terraform/graph/checks_infra/complex_solvers/and_solver/test_solver.py index a37e3e20ff8..267b40a6cff 100644 --- a/tests/terraform/graph/checks_infra/complex_solvers/and_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/complex_solvers/and_solver/test_solver.py @@ -7,7 +7,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestAndQuery(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/complex_solvers/not_solver/test_solver.py b/tests/terraform/graph/checks_infra/complex_solvers/not_solver/test_solver.py index fda2aac5be2..95534b8e9b7 100644 --- a/tests/terraform/graph/checks_infra/complex_solvers/not_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/complex_solvers/not_solver/test_solver.py @@ -7,7 +7,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestNotQuery(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/complex_solvers/or_solver/test_solver.py b/tests/terraform/graph/checks_infra/complex_solvers/or_solver/test_solver.py index 2ecdef96f1c..c0fe75023c8 100644 --- a/tests/terraform/graph/checks_infra/complex_solvers/or_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/complex_solvers/or_solver/test_solver.py @@ -7,7 +7,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class TestOrQuery(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/connection_solvers/and_connection_solver/test_solver.py b/tests/terraform/graph/checks_infra/connection_solvers/and_connection_solver/test_solver.py index efe1e7daab2..749f427e30d 100644 --- a/tests/terraform/graph/checks_infra/connection_solvers/and_connection_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/connection_solvers/and_connection_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class ConnectionSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/connection_solvers/connection_exist_solver/test_solver.py b/tests/terraform/graph/checks_infra/connection_solvers/connection_exist_solver/test_solver.py index 60a7c23c2fc..852e76c662a 100644 --- a/tests/terraform/graph/checks_infra/connection_solvers/connection_exist_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/connection_solvers/connection_exist_solver/test_solver.py @@ -11,7 +11,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class ConnectionSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/connection_solvers/connection_not_exist_solver/test_solver.py b/tests/terraform/graph/checks_infra/connection_solvers/connection_not_exist_solver/test_solver.py index 8664600a235..7e015deb80b 100644 --- a/tests/terraform/graph/checks_infra/connection_solvers/connection_not_exist_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/connection_solvers/connection_not_exist_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class ConnectionSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/connection_solvers/connection_one_exists/test_solver.py b/tests/terraform/graph/checks_infra/connection_solvers/connection_one_exists/test_solver.py index ed1c97ee919..63dc3011c19 100644 --- a/tests/terraform/graph/checks_infra/connection_solvers/connection_one_exists/test_solver.py +++ b/tests/terraform/graph/checks_infra/connection_solvers/connection_one_exists/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class ConnectionSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/checks_infra/connection_solvers/or_connection_solver/test_solver.py b/tests/terraform/graph/checks_infra/connection_solvers/or_connection_solver/test_solver.py index 0de8bc8a70b..278edd0a475 100644 --- a/tests/terraform/graph/checks_infra/connection_solvers/or_connection_solver/test_solver.py +++ b/tests/terraform/graph/checks_infra/connection_solvers/or_connection_solver/test_solver.py @@ -9,7 +9,8 @@ @parameterized_class([ {"graph_framework": "NETWORKX"}, - {"graph_framework": "IGRAPH"} + {"graph_framework": "IGRAPH"}, + {"graph_framework": "RUSTWORKX"} ]) class ConnectionSolver(TestBaseSolver): def setUp(self): diff --git a/tests/terraform/graph/db_connector/test_graph_connector.py b/tests/terraform/graph/db_connector/test_graph_connector.py index c0732e39928..c3391fda6f1 100644 --- a/tests/terraform/graph/db_connector/test_graph_connector.py +++ b/tests/terraform/graph/db_connector/test_graph_connector.py @@ -3,6 +3,7 @@ from checkov.common.graph.db_connectors.networkx.networkx_db_connector import NetworkxConnector from checkov.common.graph.db_connectors.igraph.igraph_db_connector import IgraphConnector +from checkov.common.graph.db_connectors.rustworkx.rustworkx_db_connector import RustworkxConnector from checkov.terraform.graph_builder.local_graph import TerraformLocalGraph from checkov.terraform.tf_parser import TFParser @@ -27,3 +28,12 @@ def test_creating_igraph_graph(self): local_graph._create_vertices() igc = IgraphConnector() igc.save_graph(local_graph) + + def test_creating_rustworkx_graph(self): + resources_dir = os.path.realpath(os.path.join(TEST_DIRNAME, '../resources/encryption')) + hcl_config_parser = TFParser() + module, _ = hcl_config_parser.parse_hcl_module(resources_dir, 'AWS') + local_graph = TerraformLocalGraph(module) + local_graph._create_vertices() + igc = RustworkxConnector() + igc.save_graph(local_graph) diff --git a/tests/terraform/graph/graph_builder/test_graph_builder.py b/tests/terraform/graph/graph_builder/test_graph_builder.py index 61ccb068ebc..f5dd975d485 100644 --- a/tests/terraform/graph/graph_builder/test_graph_builder.py +++ b/tests/terraform/graph/graph_builder/test_graph_builder.py @@ -3,6 +3,7 @@ from unittest import TestCase, mock from checkov.common.graph.db_connectors.networkx.networkx_db_connector import NetworkxConnector +from checkov.common.graph.db_connectors.rustworkx.rustworkx_db_connector import RustworkxConnector from checkov.terraform.graph_builder.graph_components.block_types import BlockType from checkov.terraform.graph_builder.graph_to_tf_definitions import convert_graph_vertices_to_tf_definitions from checkov.terraform.graph_manager import TerraformGraphManager @@ -334,6 +335,44 @@ def test_build_graph_for_each_with_variables_and_dynamic_not_crash(self): # Shouldn't throw exception graph_manager.build_graph_from_source_directory(resources_dir) + def test_build_rustworkx_graph(self): + resources_dir = os.path.join(TEST_DIRNAME, '../resources/general_example') + + graph_manager = TerraformGraphManager(db_connector=RustworkxConnector()) + graph, tf_definitions = graph_manager.build_graph_from_source_directory(resources_dir) + + expected_num_of_var_nodes = 3 + expected_num_of_locals_nodes = 1 + expected_num_of_resources_nodes = 1 + expected_num_of_provider_nodes = 1 + vertices_by_block_type = graph.vertices_by_block_type + self.assertEqual(expected_num_of_var_nodes, len(vertices_by_block_type[BlockType.VARIABLE])) + self.assertEqual(expected_num_of_locals_nodes, len(vertices_by_block_type[BlockType.LOCALS])) + self.assertEqual(expected_num_of_resources_nodes, len(vertices_by_block_type[BlockType.RESOURCE])) + self.assertEqual(expected_num_of_provider_nodes, len(vertices_by_block_type[BlockType.PROVIDER])) + + provider_node = graph.vertices[vertices_by_block_type[BlockType.PROVIDER][0]] + resource_node = graph.vertices[vertices_by_block_type[BlockType.RESOURCE][0]] + local_node = graph.vertices[graph.vertices_block_name_map[BlockType.LOCALS]["bucket_name"][0]] + + var_bucket_name_node = None + var_region_node = None + var_aws_profile_node = None + for index in vertices_by_block_type[BlockType.VARIABLE]: + var_node = graph.vertices[index] + if var_node.name == 'aws_profile': + var_aws_profile_node = var_node + if var_node.name == 'bucket_name': + var_bucket_name_node = var_node + if var_node.name == 'region': + var_region_node = var_node + + self.check_edge(graph, resource_node, local_node, 'bucket') + self.check_edge(graph, resource_node, provider_node, 'provider') + self.check_edge(graph, resource_node, var_region_node, 'region') + self.check_edge(graph, provider_node, var_aws_profile_node, 'profile') + self.check_edge(graph, local_node, var_bucket_name_node, 'bucket_name') + def build_new_key_for_tf_definition(key): key = key.tf_source_modules diff --git a/tests/terraform/runner/test_plan_runner.py b/tests/terraform/runner/test_plan_runner.py index b4b4efa9de0..ef27ae85faf 100644 --- a/tests/terraform/runner/test_plan_runner.py +++ b/tests/terraform/runner/test_plan_runner.py @@ -16,6 +16,7 @@ from checkov.common.bridgecrew.severities import BcSeverities, Severities from checkov.common.graph.db_connectors.igraph.igraph_db_connector import IgraphConnector from checkov.common.graph.db_connectors.networkx.networkx_db_connector import NetworkxConnector +from checkov.common.graph.db_connectors.rustworkx.rustworkx_db_connector import RustworkxConnector from checkov.common.models.enums import CheckCategories, CheckResult from checkov.runner_filter import RunnerFilter from checkov.terraform import TFDefinitionKey @@ -25,7 +26,8 @@ @parameterized_class([ {"db_connector": NetworkxConnector}, - {"db_connector": IgraphConnector} + {"db_connector": IgraphConnector}, + {"db_connector": RustworkxConnector}, ]) class TestRunnerValid(unittest.TestCase): @classmethod diff --git a/tests/terraform/runner/test_runner.py b/tests/terraform/runner/test_runner.py index 726d71c3d2d..e83d1ea946e 100644 --- a/tests/terraform/runner/test_runner.py +++ b/tests/terraform/runner/test_runner.py @@ -12,6 +12,7 @@ from igraph import Graph from networkx import DiGraph from parameterized import parameterized, parameterized_class +from rustworkx import PyDiGraph from checkov.common.bridgecrew.check_type import CheckType from checkov.common.bridgecrew.severities import Severities, BcSeverities @@ -19,6 +20,7 @@ from checkov.common.checks_infra.registry import get_graph_checks_registry from checkov.common.graph.db_connectors.igraph.igraph_db_connector import IgraphConnector from checkov.common.graph.db_connectors.networkx.networkx_db_connector import NetworkxConnector +from checkov.common.graph.db_connectors.rustworkx.rustworkx_db_connector import RustworkxConnector from checkov.common.graph.graph_builder import CustomAttributes from checkov.common.models.enums import CheckCategories, CheckResult from checkov.common.output.report import Report @@ -46,6 +48,8 @@ {"db_connector": NetworkxConnector, "tf_split_graph": "False", "graph": "NETWORKX"}, {"db_connector": IgraphConnector, "tf_split_graph": "True", "graph": "IGRAPH"}, {"db_connector": IgraphConnector, "tf_split_graph": "False", "graph": "IGRAPH"}, + {"db_connector": RustworkxConnector, "tf_split_graph": "True", "graph": "RUSTWORKX"}, + {"db_connector": RustworkxConnector, "tf_split_graph": "False", "graph": "RUSTWORKX"}, ]) class TestRunnerValid(unittest.TestCase): def setUp(self) -> None: @@ -1593,7 +1597,8 @@ def tearDown(self): @parameterized.expand([ (NetworkxConnector,), - (IgraphConnector,) + (IgraphConnector,), + (RustworkxConnector,) ]) def test_get_graph_resource_entity_config(self, graph_connector): current_dir = os.path.dirname(os.path.realpath(__file__)) @@ -1610,6 +1615,10 @@ def test_get_graph_resource_entity_config(self, graph_connector): for data in graph_connector.vs.select()["attr"]: config = Runner.get_graph_resource_entity_config(data) self.assertIn(CustomAttributes.TF_RESOURCE_ADDRESS, config) + if isinstance(graph_connector, PyDiGraph): + for _, data in graph_connector.nodes(): + config = Runner.get_graph_resource_entity_config(data) + self.assertIn(CustomAttributes.TF_RESOURCE_ADDRESS, config) @mock.patch.dict(os.environ, {"ENABLE_DEFINITION_KEY": "True"}) def test_entity_context_fetching_with_TFDefinitionKey(self):