Skip to content

Commit

Permalink
platform(general): handle the updated on prem response from the platf…
Browse files Browse the repository at this point in the history
…orm (#5809)

handle the updated on prem response from the platform
  • Loading branch information
mikeurbanski1 authored Nov 30, 2023
1 parent 7d05e11 commit 7bb5f80
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
4 changes: 3 additions & 1 deletion checkov/common/bridgecrew/platform_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -1168,7 +1168,9 @@ def get_sso_prismacloud_url(self, report_url: str) -> str:

def setup_on_prem(self) -> None:
if self.customer_run_config_response:
self.on_prem = self.customer_run_config_response.get('onPrem', False)
self.on_prem = self.customer_run_config_response.get('tenantConfig', {}).get('preventCodeUploads', False)
if self.on_prem:
logging.debug('On prem mode is enabled')


bc_integration = BcPlatformIntegration()
33 changes: 33 additions & 0 deletions tests/common/test_platform_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,39 @@ def test_is_valid_policy_filter(self):
valid_filters=mock_prisma_policy_filter_response()))
self.assertFalse(instance.is_valid_policy_filter(policy_filter={'policy.label': ['A', 'B']}, valid_filters={}))

def test_setup_on_prem(self):
instance = BcPlatformIntegration()

instance.customer_run_config_response = None
instance.setup_on_prem()
self.assertFalse(instance.on_prem)

instance.customer_run_config_response = {}
instance.setup_on_prem()
self.assertFalse(instance.on_prem)

instance.customer_run_config_response = {
'tenantConfig': {}
}
instance.setup_on_prem()
self.assertFalse(instance.on_prem)

instance.customer_run_config_response = {
'tenantConfig': {
'preventCodeUploads': False
}
}
instance.setup_on_prem()
self.assertFalse(instance.on_prem)

instance.customer_run_config_response = {
'tenantConfig': {
'preventCodeUploads': True
}
}
instance.setup_on_prem()
self.assertTrue(instance.on_prem)


def mock_customer_run_config():
return {
Expand Down

0 comments on commit 7bb5f80

Please sign in to comment.