From b43c9c4a75e031de3bb85deebe8825ce55c3584f Mon Sep 17 00:00:00 2001 From: anand k Date: Fri, 23 Feb 2024 23:50:04 +0530 Subject: [PATCH] Code Quality --- src/class_singleWorker.py | 4 +++- src/class_smtpDeliver.py | 7 ++----- src/depends.py | 2 +- src/helper_sql.py | 10 +++++----- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/class_singleWorker.py b/src/class_singleWorker.py index 5b97c536..b65f44c8 100644 --- a/src/class_singleWorker.py +++ b/src/class_singleWorker.py @@ -1370,7 +1370,9 @@ class singleWorker(StoppableThread): 'bitmessagesettings', 'apinotifypath') if apiNotifyPath: - call([apiNotifyPath, "newMessage"]) + # There is no additional risk of remote exploitation or + # privilege escalation + call([apiNotifyPath, "newMessage"]) # nosec:B603 def requestPubKey(self, toAddress): """Send a getpubkey object""" diff --git a/src/class_smtpDeliver.py b/src/class_smtpDeliver.py index ad509bbf..9e3b8ab3 100644 --- a/src/class_smtpDeliver.py +++ b/src/class_smtpDeliver.py @@ -22,11 +22,8 @@ class smtpDeliver(StoppableThread): _instance = None def stopThread(self): - # pylint: disable=no-member - try: - queues.UISignallerQueue.put(("stopThread", "data")) - except: # noqa:E722 - pass + """Relay shutdown instruction""" + queues.UISignalQueue.put(("stopThread", "data")) super(smtpDeliver, self).stopThread() @classmethod diff --git a/src/depends.py b/src/depends.py index ed3c7ce3..8bfbd313 100755 --- a/src/depends.py +++ b/src/depends.py @@ -287,7 +287,7 @@ def check_openssl(): path = ctypes.util.find_library('ssl') if path not in paths: paths.append(path) - except: # noqa:E722 + except: # nosec:B110 pylint:disable=bare-except pass openssl_version = None diff --git a/src/helper_sql.py b/src/helper_sql.py index 8dee9e0c..c9c5c2ab 100644 --- a/src/helper_sql.py +++ b/src/helper_sql.py @@ -45,7 +45,7 @@ def sqlQuery(sql_statement, *args): :param list args: SQL query parameters :rtype: list """ - assert sql_available + assert sql_available # nosec:B101 sql_lock.acquire() sqlSubmitQueue.put(sql_statement) @@ -65,7 +65,7 @@ def sqlExecuteChunked(sql_statement, idCount, *args): """Execute chunked SQL statement to avoid argument limit""" # SQLITE_MAX_VARIABLE_NUMBER, # unfortunately getting/setting isn't exposed to python - assert sql_available + assert sql_available # nosec:B101 sqlExecuteChunked.chunkSize = 999 if idCount == 0 or idCount > len(args): @@ -95,7 +95,7 @@ def sqlExecuteChunked(sql_statement, idCount, *args): def sqlExecute(sql_statement, *args): """Execute SQL statement (optionally with arguments)""" - assert sql_available + assert sql_available # nosec:B101 sql_lock.acquire() sqlSubmitQueue.put(sql_statement) @@ -120,7 +120,7 @@ def sqlExecuteScript(sql_statement): def sqlStoredProcedure(procName): """Schedule procName to be run""" - assert sql_available + assert sql_available # nosec:B101 sql_lock.acquire() sqlSubmitQueue.put(procName) if procName == "exit": @@ -143,7 +143,7 @@ class SqlBulkExecute(object): @staticmethod def execute(sql_statement, *args): """Used for statements that do not return results.""" - assert sql_available + assert sql_available # nosec:B101 sqlSubmitQueue.put(sql_statement) if args == ():