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

branch
eric7
changeset 11147
dee6e106b4d3
parent 11137
a90284948331
equal deleted inserted replaced
11146:59e04f7003e9 11147:dee6e106b4d3
19 import fnmatch 19 import fnmatch
20 20
21 import AstUtilities 21 import AstUtilities
22 22
23 _prohibitedCalls = { 23 _prohibitedCalls = {
24 "S301": ( 24 "S-301": (
25 [ 25 [
26 "pickle.loads", 26 "pickle.loads",
27 "pickle.load", 27 "pickle.load",
28 "pickle.Unpickler", 28 "pickle.Unpickler",
29 "dill.loads", 29 "dill.loads",
36 "jsonpickle.unpickler.Unpickler", 36 "jsonpickle.unpickler.Unpickler",
37 "pandas.read_pickle", 37 "pandas.read_pickle",
38 ], 38 ],
39 "M", 39 "M",
40 ), 40 ),
41 "S302": (["marshal.load", "marshal.loads"], "M"), 41 "S-302": (["marshal.load", "marshal.loads"], "M"),
42 "S303": ( 42 "S-303": (
43 [ 43 [
44 "Crypto.Hash.MD2.new", 44 "Crypto.Hash.MD2.new",
45 "Crypto.Hash.MD4.new", 45 "Crypto.Hash.MD4.new",
46 "Crypto.Hash.MD5.new", 46 "Crypto.Hash.MD5.new",
47 "Crypto.Hash.SHA.new", 47 "Crypto.Hash.SHA.new",
52 "cryptography.hazmat.primitives.hashes.MD5", 52 "cryptography.hazmat.primitives.hashes.MD5",
53 "cryptography.hazmat.primitives.hashes.SHA1", 53 "cryptography.hazmat.primitives.hashes.SHA1",
54 ], 54 ],
55 "M", 55 "M",
56 ), 56 ),
57 "S304": ( 57 "S-304": (
58 [ 58 [
59 "Crypto.Cipher.ARC2.new", 59 "Crypto.Cipher.ARC2.new",
60 "Crypto.Cipher.ARC4.new", 60 "Crypto.Cipher.ARC4.new",
61 "Crypto.Cipher.Blowfish.new", 61 "Crypto.Cipher.Blowfish.new",
62 "Crypto.Cipher.DES.new", 62 "Crypto.Cipher.DES.new",
73 "cryptography.hazmat.primitives.ciphers.algorithms.SEED", 73 "cryptography.hazmat.primitives.ciphers.algorithms.SEED",
74 "cryptography.hazmat.primitives.ciphers.algorithms.TripleDES", 74 "cryptography.hazmat.primitives.ciphers.algorithms.TripleDES",
75 ], 75 ],
76 "H", 76 "H",
77 ), 77 ),
78 "S305": (["cryptography.hazmat.primitives.ciphers.modes.ECB"], "M"), 78 "S-305": (["cryptography.hazmat.primitives.ciphers.modes.ECB"], "M"),
79 "S306": (["tempfile.mktemp"], "M"), 79 "S-306": (["tempfile.mktemp"], "M"),
80 "S307": (["eval"], "M"), 80 "S-307": (["eval"], "M"),
81 "S308": (["django.utils.safestring.mark_safe"], "M"), 81 "S-308": (["django.utils.safestring.mark_safe"], "M"),
82 "S310": ( 82 "S-310": (
83 [ 83 [
84 "urllib.request.urlopen", 84 "urllib.request.urlopen",
85 "urllib.request.urlretrieve", 85 "urllib.request.urlretrieve",
86 "urllib.request.URLopener", 86 "urllib.request.URLopener",
87 "urllib.request.FancyURLopener", 87 "urllib.request.FancyURLopener",
90 "six.moves.urllib.request.URLopener", 90 "six.moves.urllib.request.URLopener",
91 "six.moves.urllib.request.FancyURLopener", 91 "six.moves.urllib.request.FancyURLopener",
92 ], 92 ],
93 "", 93 "",
94 ), 94 ),
95 "S311": ( 95 "S-311": (
96 [ 96 [
97 "random.Random", 97 "random.Random",
98 "random.random", 98 "random.random",
99 "random.randrange", 99 "random.randrange",
100 "random.randint", 100 "random.randint",
104 "random.triangular", 104 "random.triangular",
105 "random.randbytes", 105 "random.randbytes",
106 ], 106 ],
107 "L", 107 "L",
108 ), 108 ),
109 "S312": (["telnetlib.Telnet"], "H"), 109 "S-312": (["telnetlib.Telnet"], "H"),
110 "S313": ( 110 "S-313": (
111 [ 111 [
112 "xml.etree.cElementTree.parse", 112 "xml.etree.cElementTree.parse",
113 "xml.etree.cElementTree.iterparse", 113 "xml.etree.cElementTree.iterparse",
114 "xml.etree.cElementTree.fromstring", 114 "xml.etree.cElementTree.fromstring",
115 "xml.etree.cElementTree.XMLParser", 115 "xml.etree.cElementTree.XMLParser",
116 ], 116 ],
117 "M", 117 "M",
118 ), 118 ),
119 "S314": ( 119 "S-314": (
120 [ 120 [
121 "xml.etree.ElementTree.parse", 121 "xml.etree.ElementTree.parse",
122 "xml.etree.ElementTree.iterparse", 122 "xml.etree.ElementTree.iterparse",
123 "xml.etree.ElementTree.fromstring", 123 "xml.etree.ElementTree.fromstring",
124 "xml.etree.ElementTree.XMLParser", 124 "xml.etree.ElementTree.XMLParser",
125 ], 125 ],
126 "M", 126 "M",
127 ), 127 ),
128 "S315": (["xml.sax.expatreader.create_parser"], "M"), 128 "S-315": (["xml.sax.expatreader.create_parser"], "M"),
129 "S316": ( 129 "S-316": (
130 ["xml.dom.expatbuilder.parse", "xml.dom.expatbuilder.parseString"], 130 ["xml.dom.expatbuilder.parse", "xml.dom.expatbuilder.parseString"],
131 "M", 131 "M",
132 ), 132 ),
133 "S317": (["xml.sax.parse", "xml.sax.parseString", "xml.sax.make_parser"], "M"), 133 "S-317": (["xml.sax.parse", "xml.sax.parseString", "xml.sax.make_parser"], "M"),
134 "S318": (["xml.dom.minidom.parse", "xml.dom.minidom.parseString"], "M"), 134 "S-318": (["xml.dom.minidom.parse", "xml.dom.minidom.parseString"], "M"),
135 "S319": (["xml.dom.pulldom.parse", "xml.dom.pulldom.parseString"], "M"), 135 "S-319": (["xml.dom.pulldom.parse", "xml.dom.pulldom.parseString"], "M"),
136 "S321": (["ftplib.FTP"], "H"), 136 "S-321": (["ftplib.FTP"], "H"),
137 "S323": (["ssl._create_unverified_context"], "M"), 137 "S-323": (["ssl._create_unverified_context"], "M"),
138 } 138 }
139 139
140 140
141 def getChecks(): 141 def getChecks():
142 """ 142 """

eric ide

mercurial