eric6/Plugins/CheckerPlugins/CodeStyleChecker/Security/Checks/injectionShell.py

changeset 8259
2bbec88047dd
parent 8222
5994b80b8760
diff -r 82b608e352ec -r 2bbec88047dd eric6/Plugins/CheckerPlugins/CodeStyleChecker/Security/Checks/injectionShell.py
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Security/Checks/injectionShell.py	Wed Apr 21 17:56:12 2021 +0200
+++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Security/Checks/injectionShell.py	Wed Apr 21 19:40:50 2021 +0200
@@ -109,10 +109,11 @@
     @param config dictionary with configuration data
     @type dict
     """
-    if config and "shell_injection_subprocess" in config:
-        functionNames = config["shell_injection_subprocess"]
-    else:
-        functionNames = SecurityDefaults["shell_injection_subprocess"]
+    functionNames = (
+        config["shell_injection_subprocess"]
+        if config and "shell_injection_subprocess" in config else
+        SecurityDefaults["shell_injection_subprocess"]
+    )
     
     if context.callFunctionNameQual in functionNames:
         shell, shellValue = hasShell(context)
@@ -147,10 +148,11 @@
     @param config dictionary with configuration data
     @type dict
     """
-    if config and "shell_injection_subprocess" in config:
-        functionNames = config["shell_injection_subprocess"]
-    else:
-        functionNames = SecurityDefaults["shell_injection_subprocess"]
+    functionNames = (
+        config["shell_injection_subprocess"]
+        if config and "shell_injection_subprocess" in config else
+        SecurityDefaults["shell_injection_subprocess"]
+    )
     
     if (
         context.callFunctionNameQual in functionNames and
@@ -176,10 +178,11 @@
     @param config dictionary with configuration data
     @type dict
     """
-    if config and "shell_injection_subprocess" in config:
-        functionNames = config["shell_injection_subprocess"]
-    else:
-        functionNames = SecurityDefaults["shell_injection_subprocess"]
+    functionNames = (
+        config["shell_injection_subprocess"]
+        if config and "shell_injection_subprocess" in config else
+        SecurityDefaults["shell_injection_subprocess"]
+    )
     
     if context.callFunctionNameQual not in functionNames:
         shell, shellValue = hasShell(context)
@@ -204,10 +207,11 @@
     @param config dictionary with configuration data
     @type dict
     """
-    if config and "shell_injection_shell" in config:
-        functionNames = config["shell_injection_shell"]
-    else:
-        functionNames = SecurityDefaults["shell_injection_shell"]
+    functionNames = (
+        config["shell_injection_shell"]
+        if config and "shell_injection_shell" in config else
+        SecurityDefaults["shell_injection_shell"]
+    )
     
     if (
         context.callFunctionNameQual in functionNames and
@@ -243,10 +247,11 @@
     @param config dictionary with configuration data
     @type dict
     """
-    if config and "shell_injection_noshell" in config:
-        functionNames = config["shell_injection_noshell"]
-    else:
-        functionNames = SecurityDefaults["shell_injection_noshell"]
+    functionNames = (
+        config["shell_injection_noshell"]
+        if config and "shell_injection_noshell" in config else
+        SecurityDefaults["shell_injection_noshell"]
+    )
     
     if context.callFunctionNameQual in functionNames:
         reportError(
@@ -269,10 +274,11 @@
     @param config dictionary with configuration data
     @type dict
     """
-    if config and "shell_injection_subprocess" in config:
-        functionNames = config["shell_injection_subprocess"]
-    else:
-        functionNames = SecurityDefaults["shell_injection_subprocess"]
+    functionNames = (
+        config["shell_injection_subprocess"]
+        if config and "shell_injection_subprocess" in config else
+        SecurityDefaults["shell_injection_subprocess"]
+    )
     
     if config and "shell_injection_shell" in config:
         functionNames += config["shell_injection_shell"]

eric ide

mercurial