From 09f90daba0dd0cadb1df56538fe72933e6a54ce3 Mon Sep 17 00:00:00 2001 From: Mohammad Zuber Khan Date: Tue, 15 Sep 2020 13:06:54 -0700 Subject: [PATCH] fix the parameters passed for remediation --- ...azure_storage_account_allow_https_traffic_only.py | 12 +++++------- .../azure_vm_close_port_22/azure_vm_close_port_22.py | 5 +---- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/remediation_worker/jobs/azure_storage_account_allow_https_traffic_only/azure_storage_account_allow_https_traffic_only.py b/remediation_worker/jobs/azure_storage_account_allow_https_traffic_only/azure_storage_account_allow_https_traffic_only.py index 36d4c11..1ece258 100644 --- a/remediation_worker/jobs/azure_storage_account_allow_https_traffic_only/azure_storage_account_allow_https_traffic_only.py +++ b/remediation_worker/jobs/azure_storage_account_allow_https_traffic_only/azure_storage_account_allow_https_traffic_only.py @@ -44,13 +44,13 @@ def parse(self, payload): :raises: KeyError, JSONDecodeError """ remediation_entry = json.loads(payload) - logging.info("unparsed params") - logging.info(f" {remediation_entry}") account_name = remediation_entry["notificationInfo"]["FindingInfo"]["ObjectId"] region = remediation_entry["notificationInfo"]["FindingInfo"]["Region"] - object_chain = remediation_entry["notificationInfo"]["FindingInfo"]["ObjectChain"] + object_chain = remediation_entry["notificationInfo"]["FindingInfo"][ + "ObjectChain" + ] object_chain_dict = json.loads(object_chain) subscription_id = object_chain_dict["cloudAccountId"] @@ -93,9 +93,7 @@ def remediate(self, client, resource_group_name, account_name): # Allow only https traffic for the storage account logging.info("Enabling HTTPS only traffic for storage account") try: - logging.info( - " executing client.storage_accounts.update" - ) + logging.info(" executing client.storage_accounts.update") logging.info(f" resource_group_name={resource_group_name}") logging.info(f" account_name={account_name}") client.storage_accounts.update( @@ -126,7 +124,7 @@ def run(self, args): client = StorageManagementClient(credentials, params["subscription_id"]) return self.remediate( - client, params["resource_group_name"], params["account_name"], params["container_name"] + client, params["resource_group_name"], params["account_name"] ) diff --git a/remediation_worker/jobs/azure_vm_close_port_22/azure_vm_close_port_22.py b/remediation_worker/jobs/azure_vm_close_port_22/azure_vm_close_port_22.py index cc031ab..88f1d2e 100644 --- a/remediation_worker/jobs/azure_vm_close_port_22/azure_vm_close_port_22.py +++ b/remediation_worker/jobs/azure_vm_close_port_22/azure_vm_close_port_22.py @@ -215,10 +215,7 @@ def run(self, args): compute_client = ComputeManagementClient(credentials, params["subscription_id"]) nw_client = NetworkManagementClient(credentials, params["subscription_id"]) return self.remediate( - compute_client, - nw_client, - params["resource_group_name"], - params["security_group_name"], + compute_client, nw_client, params["resource_group_name"], params["vm_name"], )