From 8fffdc61d5cc2d4615d185a315b1d50eac48d99d Mon Sep 17 00:00:00 2001 From: Ofek Shimko <70918223+OfekShimko@users.noreply.github.com> Date: Thu, 18 Apr 2024 09:31:38 +0300 Subject: [PATCH] feat(sca): support licenses custom policies enforcement rules (#6173) * support custom lic policies enforcement rules * support custom lic policies enforcement rules * support custom lic policies enforcement rules * support custom lic policies enforcement rules * stay backwards compatible * flake 8 --------- Co-authored-by: oshimko --- .../features/policy_metadata_integration.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/checkov/common/bridgecrew/integration_features/features/policy_metadata_integration.py b/checkov/common/bridgecrew/integration_features/features/policy_metadata_integration.py index d904f10d3be..d3853f9e90b 100644 --- a/checkov/common/bridgecrew/integration_features/features/policy_metadata_integration.py +++ b/checkov/common/bridgecrew/integration_features/features/policy_metadata_integration.py @@ -151,10 +151,11 @@ def _handle_customer_run_config(self, run_config: dict[str, Any]) -> None: # Custom policies are returned in run_config['customPolicies'] rather than run_config['policyMetadata']. if 'customPolicies' in run_config: for custom_policy in run_config['customPolicies']: - if 'guideline' in custom_policy: - self.check_metadata[custom_policy['id']] = { - 'guideline': custom_policy['guideline'] - } + custom_policy_check_metadata = { + 'severity': custom_policy.get('severity'), + 'guideline': custom_policy.get('guideline') + } + self.check_metadata[custom_policy['id']] = {k: v for k, v in custom_policy_check_metadata.items() if v is not None} pc_policy_id = custom_policy.get('pcPolicyId') if pc_policy_id: self.pc_to_ckv_id_mapping[pc_policy_id] = custom_policy['id']