src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Security/Checks/prohibitedCalls.py

branch
eric7
changeset 11137
a90284948331
parent 11136
437db2f032fd
child 11147
dee6e106b4d3
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Security/Checks/prohibitedCalls.py	Sun Feb 16 12:10:10 2025 +0100
+++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Security/Checks/prohibitedCalls.py	Sun Feb 16 14:56:07 2025 +0100
@@ -39,108 +39,103 @@
         "M",
     ),
     "S302": (["marshal.load", "marshal.loads"], "M"),
+    "S303": (
+        [
+            "Crypto.Hash.MD2.new",
+            "Crypto.Hash.MD4.new",
+            "Crypto.Hash.MD5.new",
+            "Crypto.Hash.SHA.new",
+            "Cryptodome.Hash.MD2.new",
+            "Cryptodome.Hash.MD4.new",
+            "Cryptodome.Hash.MD5.new",
+            "Cryptodome.Hash.SHA.new",
+            "cryptography.hazmat.primitives.hashes.MD5",
+            "cryptography.hazmat.primitives.hashes.SHA1",
+        ],
+        "M",
+    ),
+    "S304": (
+        [
+            "Crypto.Cipher.ARC2.new",
+            "Crypto.Cipher.ARC4.new",
+            "Crypto.Cipher.Blowfish.new",
+            "Crypto.Cipher.DES.new",
+            "Crypto.Cipher.XOR.new",
+            "Cryptodome.Cipher.ARC2.new",
+            "Cryptodome.Cipher.ARC4.new",
+            "Cryptodome.Cipher.Blowfish.new",
+            "Cryptodome.Cipher.DES.new",
+            "Cryptodome.Cipher.XOR.new",
+            "cryptography.hazmat.primitives.ciphers.algorithms.ARC4",
+            "cryptography.hazmat.primitives.ciphers.algorithms.Blowfish",
+            "cryptography.hazmat.primitives.ciphers.algorithms.CAST5",
+            "cryptography.hazmat.primitives.ciphers.algorithms.IDEA",
+            "cryptography.hazmat.primitives.ciphers.algorithms.SEED",
+            "cryptography.hazmat.primitives.ciphers.algorithms.TripleDES",
+        ],
+        "H",
+    ),
+    "S305": (["cryptography.hazmat.primitives.ciphers.modes.ECB"], "M"),
+    "S306": (["tempfile.mktemp"], "M"),
+    "S307": (["eval"], "M"),
+    "S308": (["django.utils.safestring.mark_safe"], "M"),
+    "S310": (
+        [
+            "urllib.request.urlopen",
+            "urllib.request.urlretrieve",
+            "urllib.request.URLopener",
+            "urllib.request.FancyURLopener",
+            "six.moves.urllib.request.urlopen",
+            "six.moves.urllib.request.urlretrieve",
+            "six.moves.urllib.request.URLopener",
+            "six.moves.urllib.request.FancyURLopener",
+        ],
+        "",
+    ),
+    "S311": (
+        [
+            "random.Random",
+            "random.random",
+            "random.randrange",
+            "random.randint",
+            "random.choice",
+            "random.choices",
+            "random.uniform",
+            "random.triangular",
+            "random.randbytes",
+        ],
+        "L",
+    ),
+    "S312": (["telnetlib.Telnet"], "H"),
+    "S313": (
+        [
+            "xml.etree.cElementTree.parse",
+            "xml.etree.cElementTree.iterparse",
+            "xml.etree.cElementTree.fromstring",
+            "xml.etree.cElementTree.XMLParser",
+        ],
+        "M",
+    ),
+    "S314": (
+        [
+            "xml.etree.ElementTree.parse",
+            "xml.etree.ElementTree.iterparse",
+            "xml.etree.ElementTree.fromstring",
+            "xml.etree.ElementTree.XMLParser",
+        ],
+        "M",
+    ),
+    "S315": (["xml.sax.expatreader.create_parser"], "M"),
+    "S316": (
+        ["xml.dom.expatbuilder.parse", "xml.dom.expatbuilder.parseString"],
+        "M",
+    ),
+    "S317": (["xml.sax.parse", "xml.sax.parseString", "xml.sax.make_parser"], "M"),
+    "S318": (["xml.dom.minidom.parse", "xml.dom.minidom.parseString"], "M"),
+    "S319": (["xml.dom.pulldom.parse", "xml.dom.pulldom.parseString"], "M"),
+    "S321": (["ftplib.FTP"], "H"),
+    "S323": (["ssl._create_unverified_context"], "M"),
 }
-_prohibitedCalls["S303"] = (
-    [
-        "Crypto.Hash.MD2.new",
-        "Crypto.Hash.MD4.new",
-        "Crypto.Hash.MD5.new",
-        "Crypto.Hash.SHA.new",
-        "Cryptodome.Hash.MD2.new",
-        "Cryptodome.Hash.MD4.new",
-        "Cryptodome.Hash.MD5.new",
-        "Cryptodome.Hash.SHA.new",
-        "cryptography.hazmat.primitives.hashes.MD5",
-        "cryptography.hazmat.primitives.hashes.SHA1",
-    ],
-    "M",
-)
-
-_prohibitedCalls.update(
-    {
-        "S304": (
-            [
-                "Crypto.Cipher.ARC2.new",
-                "Crypto.Cipher.ARC4.new",
-                "Crypto.Cipher.Blowfish.new",
-                "Crypto.Cipher.DES.new",
-                "Crypto.Cipher.XOR.new",
-                "Cryptodome.Cipher.ARC2.new",
-                "Cryptodome.Cipher.ARC4.new",
-                "Cryptodome.Cipher.Blowfish.new",
-                "Cryptodome.Cipher.DES.new",
-                "Cryptodome.Cipher.XOR.new",
-                "cryptography.hazmat.primitives.ciphers.algorithms.ARC4",
-                "cryptography.hazmat.primitives.ciphers.algorithms.Blowfish",
-                "cryptography.hazmat.primitives.ciphers.algorithms.CAST5",
-                "cryptography.hazmat.primitives.ciphers.algorithms.IDEA",
-                "cryptography.hazmat.primitives.ciphers.algorithms.SEED",
-                "cryptography.hazmat.primitives.ciphers.algorithms.TripleDES",
-            ],
-            "H",
-        ),
-        "S305": (["cryptography.hazmat.primitives.ciphers.modes.ECB"], "M"),
-        "S306": (["tempfile.mktemp"], "M"),
-        "S307": (["eval"], "M"),
-        "S308": (["django.utils.safestring.mark_safe"], "M"),
-        "S310": (
-            [
-                "urllib.request.urlopen",
-                "urllib.request.urlretrieve",
-                "urllib.request.URLopener",
-                "urllib.request.FancyURLopener",
-                "six.moves.urllib.request.urlopen",
-                "six.moves.urllib.request.urlretrieve",
-                "six.moves.urllib.request.URLopener",
-                "six.moves.urllib.request.FancyURLopener",
-            ],
-            "",
-        ),
-        "S311": (
-            [
-                "random.Random",
-                "random.random",
-                "random.randrange",
-                "random.randint",
-                "random.choice",
-                "random.choices",
-                "random.uniform",
-                "random.triangular",
-                "random.randbytes",
-            ],
-            "L",
-        ),
-        "S312": (["telnetlib.Telnet"], "H"),
-        "S313": (
-            [
-                "xml.etree.cElementTree.parse",
-                "xml.etree.cElementTree.iterparse",
-                "xml.etree.cElementTree.fromstring",
-                "xml.etree.cElementTree.XMLParser",
-            ],
-            "M",
-        ),
-        "S314": (
-            [
-                "xml.etree.ElementTree.parse",
-                "xml.etree.ElementTree.iterparse",
-                "xml.etree.ElementTree.fromstring",
-                "xml.etree.ElementTree.XMLParser",
-            ],
-            "M",
-        ),
-        "S315": (["xml.sax.expatreader.create_parser"], "M"),
-        "S316": (
-            ["xml.dom.expatbuilder.parse", "xml.dom.expatbuilder.parseString"],
-            "M",
-        ),
-        "S317": (["xml.sax.parse", "xml.sax.parseString", "xml.sax.make_parser"], "M"),
-        "S318": (["xml.dom.minidom.parse", "xml.dom.minidom.parseString"], "M"),
-        "S319": (["xml.dom.pulldom.parse", "xml.dom.pulldom.parseString"], "M"),
-        "S321": (["ftplib.FTP"], "H"),
-        "S323": (["ssl._create_unverified_context"], "M"),
-    }
-)
 
 
 def getChecks():

eric ide

mercurial