From d33efee40c7a9c583555671116b3f18583357627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lipovsk=C3=BD?= Date: Mon, 13 Mar 2023 12:55:24 +0100 Subject: [PATCH 1/2] Bandit: Fix B113: request_without_timeout --- iib/workers/greenwave.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iib/workers/greenwave.py b/iib/workers/greenwave.py index adc280a0..98c890b5 100644 --- a/iib/workers/greenwave.py +++ b/iib/workers/greenwave.py @@ -48,7 +48,7 @@ def gate_bundles(bundles: List[str], greenwave_config: GreenwaveConfig) -> None: ) request_url = f'{conf["iib_greenwave_url"].rstrip("/")}/decision' - resp = requests.post(request_url, json=payload) + resp = requests.post(request_url, json=payload, timeout=30) try: data = resp.json() except json.JSONDecodeError: From 633e617dc86da2f7e59b2c65425c960f2b06527a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lipovsk=C3=BD?= Date: Mon, 13 Mar 2023 13:39:07 +0100 Subject: [PATCH 2/2] Bandit: Disable B103: set_bad_file_permissions We need this permission for log files. --- iib/workers/tasks/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iib/workers/tasks/utils.py b/iib/workers/tasks/utils.py index a8f1a341..247ad061 100644 --- a/iib/workers/tasks/utils.py +++ b/iib/workers/tasks/utils.py @@ -883,7 +883,7 @@ def wrapper(*args, **kwargs) -> None: request_log_handler = logging.FileHandler(log_file_path) request_log_handler.setLevel(log_level) request_log_handler.setFormatter(log_formatter) - os.chmod(log_file_path, 0o664) + os.chmod(log_file_path, 0o664) # nosec logger = logging.getLogger() logger.addHandler(request_log_handler) worker_info = f'Host: {socket.getfqdn()}; User: {getpass.getuser()}'