src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Security/translations.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9325
8157eb19aba5
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
14 _securityMessages = { 14 _securityMessages = {
15 # assert used 15 # assert used
16 "S101": QCoreApplication.translate( 16 "S101": QCoreApplication.translate(
17 "Security", 17 "Security",
18 "Use of 'assert' detected. The enclosed code will be removed when" 18 "Use of 'assert' detected. The enclosed code will be removed when"
19 " compiling to optimised byte code."), 19 " compiling to optimised byte code.",
20 20 ),
21 # exec used 21 # exec used
22 "S102": QCoreApplication.translate( 22 "S102": QCoreApplication.translate("Security", "Use of 'exec' detected."),
23 "Security",
24 "Use of 'exec' detected."),
25
26 # bad file permissions 23 # bad file permissions
27 "S103": QCoreApplication.translate( 24 "S103": QCoreApplication.translate(
28 "Security", 25 "Security", "'chmod' setting a permissive mask {0} on file ({1})."
29 "'chmod' setting a permissive mask {0} on file ({1})."), 26 ),
30
31 # bind to all interfaces 27 # bind to all interfaces
32 "S104": QCoreApplication.translate( 28 "S104": QCoreApplication.translate(
33 "Security", 29 "Security", "Possible binding to all interfaces."
34 "Possible binding to all interfaces."), 30 ),
35
36 # hardcoded passwords 31 # hardcoded passwords
37 "S105": QCoreApplication.translate( 32 "S105": QCoreApplication.translate(
38 "Security", 33 "Security", "Possible hardcoded password: '{0}'"
39 "Possible hardcoded password: '{0}'"), 34 ),
40 "S106": QCoreApplication.translate( 35 "S106": QCoreApplication.translate(
41 "Security", 36 "Security", "Possible hardcoded password: '{0}'"
42 "Possible hardcoded password: '{0}'"), 37 ),
43 "S107": QCoreApplication.translate( 38 "S107": QCoreApplication.translate(
44 "Security", 39 "Security", "Possible hardcoded password: '{0}'"
45 "Possible hardcoded password: '{0}'"), 40 ),
46
47 # hardcoded tmp directory 41 # hardcoded tmp directory
48 "S108": QCoreApplication.translate( 42 "S108": QCoreApplication.translate(
49 "Security", 43 "Security", "Probable insecure usage of temp file/directory."
50 "Probable insecure usage of temp file/directory."), 44 ),
51
52 # try-except 45 # try-except
53 "S110": QCoreApplication.translate( 46 "S110": QCoreApplication.translate("Security", "Try, Except, Pass detected."),
54 "Security", 47 "S112": QCoreApplication.translate("Security", "Try, Except, Continue detected."),
55 "Try, Except, Pass detected."),
56 "S112": QCoreApplication.translate(
57 "Security",
58 "Try, Except, Continue detected."),
59
60 # flask app 48 # flask app
61 "S201": QCoreApplication.translate( 49 "S201": QCoreApplication.translate(
62 "Security", 50 "Security",
63 "A Flask app appears to be run with debug=True, which exposes the" 51 "A Flask app appears to be run with debug=True, which exposes the"
64 " Werkzeug debugger and allows the execution of arbitrary code."), 52 " Werkzeug debugger and allows the execution of arbitrary code.",
65 53 ),
66 # blacklisted calls 54 # blacklisted calls
67 "S301": QCoreApplication.translate( 55 "S301": QCoreApplication.translate(
68 "Security", 56 "Security",
69 "Pickle and modules that wrap it can be unsafe when used to " 57 "Pickle and modules that wrap it can be unsafe when used to "
70 "deserialize untrusted data, possible security issue."), 58 "deserialize untrusted data, possible security issue.",
59 ),
71 "S302": QCoreApplication.translate( 60 "S302": QCoreApplication.translate(
72 "Security", 61 "Security", "Deserialization with the marshal module is possibly dangerous."
73 "Deserialization with the marshal module is possibly dangerous."), 62 ),
74 "S303": QCoreApplication.translate( 63 "S303": QCoreApplication.translate(
75 "Security", 64 "Security", "Use of insecure MD2, MD4, MD5, or SHA1 hash function."
76 "Use of insecure MD2, MD4, MD5, or SHA1 hash function."), 65 ),
77 "S304": QCoreApplication.translate( 66 "S304": QCoreApplication.translate(
78 "Security", 67 "Security",
79 "Use of insecure cipher '{0}'. Replace with a known secure cipher" 68 "Use of insecure cipher '{0}'. Replace with a known secure cipher"
80 " such as AES."), 69 " such as AES.",
70 ),
81 "S305": QCoreApplication.translate( 71 "S305": QCoreApplication.translate(
82 "Security", 72 "Security", "Use of insecure cipher mode '{0}'."
83 "Use of insecure cipher mode '{0}'."), 73 ),
84 "S306": QCoreApplication.translate( 74 "S306": QCoreApplication.translate(
85 "Security", 75 "Security", "Use of insecure and deprecated function (mktemp)."
86 "Use of insecure and deprecated function (mktemp)."), 76 ),
87 "S307": QCoreApplication.translate( 77 "S307": QCoreApplication.translate(
88 "Security", 78 "Security",
89 "Use of possibly insecure function - consider using safer" 79 "Use of possibly insecure function - consider using safer" " ast.literal_eval.",
90 " ast.literal_eval."), 80 ),
91 "S308": QCoreApplication.translate( 81 "S308": QCoreApplication.translate(
92 "Security", 82 "Security",
93 "Use of mark_safe() may expose cross-site scripting vulnerabilities" 83 "Use of mark_safe() may expose cross-site scripting vulnerabilities"
94 " and should be reviewed."), 84 " and should be reviewed.",
85 ),
95 "S309": QCoreApplication.translate( 86 "S309": QCoreApplication.translate(
96 "Security", 87 "Security",
97 "Use of HTTPSConnection on older versions of Python prior to 2.7.9" 88 "Use of HTTPSConnection on older versions of Python prior to 2.7.9"
98 " and 3.4.3 do not provide security, see" 89 " and 3.4.3 do not provide security, see"
99 " https://wiki.openstack.org/wiki/OSSN/OSSN-0033"), 90 " https://wiki.openstack.org/wiki/OSSN/OSSN-0033",
91 ),
100 "S310": QCoreApplication.translate( 92 "S310": QCoreApplication.translate(
101 "Security", 93 "Security",
102 "Audit url open for permitted schemes. Allowing use of file:/ or" 94 "Audit url open for permitted schemes. Allowing use of file:/ or"
103 " custom schemes is often unexpected."), 95 " custom schemes is often unexpected.",
96 ),
104 "S311": QCoreApplication.translate( 97 "S311": QCoreApplication.translate(
105 "Security", 98 "Security",
106 "Standard pseudo-random generators are not suitable for" 99 "Standard pseudo-random generators are not suitable for"
107 " security/cryptographic purposes."), 100 " security/cryptographic purposes.",
101 ),
108 "S312": QCoreApplication.translate( 102 "S312": QCoreApplication.translate(
109 "Security", 103 "Security",
110 "Telnet-related functions are being called. Telnet is considered" 104 "Telnet-related functions are being called. Telnet is considered"
111 " insecure. Use SSH or some other encrypted protocol."), 105 " insecure. Use SSH or some other encrypted protocol.",
106 ),
112 "S313": QCoreApplication.translate( 107 "S313": QCoreApplication.translate(
113 "Security", 108 "Security",
114 "Using '{0}' to parse untrusted XML data is known to be vulnerable to" 109 "Using '{0}' to parse untrusted XML data is known to be vulnerable to"
115 " XML attacks. Replace '{0}' with its defusedxml equivalent function" 110 " XML attacks. Replace '{0}' with its defusedxml equivalent function"
116 " or make sure defusedxml.defuse_stdlib() is called."), 111 " or make sure defusedxml.defuse_stdlib() is called.",
112 ),
117 "S314": QCoreApplication.translate( 113 "S314": QCoreApplication.translate(
118 "Security", 114 "Security",
119 "Using '{0}' to parse untrusted XML data is known to be vulnerable to" 115 "Using '{0}' to parse untrusted XML data is known to be vulnerable to"
120 " XML attacks. Replace '{0}' with its defusedxml equivalent function" 116 " XML attacks. Replace '{0}' with its defusedxml equivalent function"
121 " or make sure defusedxml.defuse_stdlib() is called."), 117 " or make sure defusedxml.defuse_stdlib() is called.",
118 ),
122 "S315": QCoreApplication.translate( 119 "S315": QCoreApplication.translate(
123 "Security", 120 "Security",
124 "Using '{0}' to parse untrusted XML data is known to be vulnerable to" 121 "Using '{0}' to parse untrusted XML data is known to be vulnerable to"
125 " XML attacks. Replace '{0}' with its defusedxml equivalent function" 122 " XML attacks. Replace '{0}' with its defusedxml equivalent function"
126 " or make sure defusedxml.defuse_stdlib() is called."), 123 " or make sure defusedxml.defuse_stdlib() is called.",
124 ),
127 "S316": QCoreApplication.translate( 125 "S316": QCoreApplication.translate(
128 "Security", 126 "Security",
129 "Using '{0}' to parse untrusted XML data is known to be vulnerable to" 127 "Using '{0}' to parse untrusted XML data is known to be vulnerable to"
130 " XML attacks. Replace '{0}' with its defusedxml equivalent function" 128 " XML attacks. Replace '{0}' with its defusedxml equivalent function"
131 " or make sure defusedxml.defuse_stdlib() is called."), 129 " or make sure defusedxml.defuse_stdlib() is called.",
130 ),
132 "S317": QCoreApplication.translate( 131 "S317": QCoreApplication.translate(
133 "Security", 132 "Security",
134 "Using '{0}' to parse untrusted XML data is known to be vulnerable to" 133 "Using '{0}' to parse untrusted XML data is known to be vulnerable to"
135 " XML attacks. Replace '{0}' with its defusedxml equivalent function" 134 " XML attacks. Replace '{0}' with its defusedxml equivalent function"
136 " or make sure defusedxml.defuse_stdlib() is called."), 135 " or make sure defusedxml.defuse_stdlib() is called.",
136 ),
137 "S318": QCoreApplication.translate( 137 "S318": QCoreApplication.translate(
138 "Security", 138 "Security",
139 "Using '{0}' to parse untrusted XML data is known to be vulnerable to" 139 "Using '{0}' to parse untrusted XML data is known to be vulnerable to"
140 " XML attacks. Replace '{0}' with its defusedxml equivalent function" 140 " XML attacks. Replace '{0}' with its defusedxml equivalent function"
141 " or make sure defusedxml.defuse_stdlib() is called."), 141 " or make sure defusedxml.defuse_stdlib() is called.",
142 ),
142 "S319": QCoreApplication.translate( 143 "S319": QCoreApplication.translate(
143 "Security", 144 "Security",
144 "Using '{0}' to parse untrusted XML data is known to be vulnerable to" 145 "Using '{0}' to parse untrusted XML data is known to be vulnerable to"
145 " XML attacks. Replace '{0}' with its defusedxml equivalent function" 146 " XML attacks. Replace '{0}' with its defusedxml equivalent function"
146 " or make sure defusedxml.defuse_stdlib() is called."), 147 " or make sure defusedxml.defuse_stdlib() is called.",
148 ),
147 "S320": QCoreApplication.translate( 149 "S320": QCoreApplication.translate(
148 "Security", 150 "Security",
149 "Using '{0}' to parse untrusted XML data is known to be vulnerable to" 151 "Using '{0}' to parse untrusted XML data is known to be vulnerable to"
150 " XML attacks. Replace '{0}' with its defusedxml equivalent" 152 " XML attacks. Replace '{0}' with its defusedxml equivalent"
151 " function."), 153 " function.",
154 ),
152 "S321": QCoreApplication.translate( 155 "S321": QCoreApplication.translate(
153 "Security", 156 "Security",
154 "FTP-related functions are being called. FTP is considered insecure." 157 "FTP-related functions are being called. FTP is considered insecure."
155 " Use SSH/SFTP/SCP or some other encrypted protocol."), 158 " Use SSH/SFTP/SCP or some other encrypted protocol.",
159 ),
156 "S322": QCoreApplication.translate( 160 "S322": QCoreApplication.translate(
157 "Security", 161 "Security",
158 "The input method in Python 2 will read from standard input, evaluate" 162 "The input method in Python 2 will read from standard input, evaluate"
159 " and run the resulting string as Python source code. This is" 163 " and run the resulting string as Python source code. This is"
160 " similar, though in many ways worse, than using eval. On Python 2," 164 " similar, though in many ways worse, than using eval. On Python 2,"
161 " use raw_input instead, input is safe in Python 3."), 165 " use raw_input instead, input is safe in Python 3.",
166 ),
162 "S323": QCoreApplication.translate( 167 "S323": QCoreApplication.translate(
163 "Security", 168 "Security",
164 "By default, Python will create a secure, verified SSL context for" 169 "By default, Python will create a secure, verified SSL context for"
165 " use in such classes as HTTPSConnection. However, it still allows" 170 " use in such classes as HTTPSConnection. However, it still allows"
166 " using an insecure context via the _create_unverified_context that" 171 " using an insecure context via the _create_unverified_context that"
167 " reverts to the previous behavior that does not validate" 172 " reverts to the previous behavior that does not validate"
168 " certificates or perform hostname checks."), 173 " certificates or perform hostname checks.",
174 ),
169 "S324": QCoreApplication.translate( 175 "S324": QCoreApplication.translate(
170 "Security", 176 "Security",
171 "Use of os.tempnam() and os.tmpnam() is vulnerable to symlink" 177 "Use of os.tempnam() and os.tmpnam() is vulnerable to symlink"
172 " attacks. Consider using tmpfile() instead."), 178 " attacks. Consider using tmpfile() instead.",
173 179 ),
174 # hashlib.new 180 # hashlib.new
175 "S331": QCoreApplication.translate( 181 "S331": QCoreApplication.translate(
176 "Security", 182 "Security", "Use of insecure {0} hash function."
177 "Use of insecure {0} hash function."), 183 ),
178
179 # blacklisted imports 184 # blacklisted imports
180 "S401": QCoreApplication.translate( 185 "S401": QCoreApplication.translate(
181 "Security", 186 "Security",
182 "A telnet-related module is being imported. Telnet is considered" 187 "A telnet-related module is being imported. Telnet is considered"
183 " insecure. Use SSH or some other encrypted protocol."), 188 " insecure. Use SSH or some other encrypted protocol.",
189 ),
184 "S402": QCoreApplication.translate( 190 "S402": QCoreApplication.translate(
185 "Security", 191 "Security",
186 "A FTP-related module is being imported. FTP is considered" 192 "A FTP-related module is being imported. FTP is considered"
187 " insecure. Use SSH/SFTP/SCP or some other encrypted protocol."), 193 " insecure. Use SSH/SFTP/SCP or some other encrypted protocol.",
194 ),
188 "S403": QCoreApplication.translate( 195 "S403": QCoreApplication.translate(
189 "Security", 196 "Security",
190 "Consider possible security implications associated with the '{0}'" 197 "Consider possible security implications associated with the '{0}'" " module.",
191 " module."), 198 ),
192 "S404": QCoreApplication.translate( 199 "S404": QCoreApplication.translate(
193 "Security", 200 "Security",
194 "Consider possible security implications associated with the '{0}'" 201 "Consider possible security implications associated with the '{0}'" " module.",
195 " module."), 202 ),
196 "S405": QCoreApplication.translate( 203 "S405": QCoreApplication.translate(
197 "Security", 204 "Security",
198 "Using '{0}' to parse untrusted XML data is known to be vulnerable" 205 "Using '{0}' to parse untrusted XML data is known to be vulnerable"
199 " to XML attacks. Replace '{0}' with the equivalent defusedxml" 206 " to XML attacks. Replace '{0}' with the equivalent defusedxml"
200 " package, or make sure defusedxml.defuse_stdlib() is called."), 207 " package, or make sure defusedxml.defuse_stdlib() is called.",
208 ),
201 "S406": QCoreApplication.translate( 209 "S406": QCoreApplication.translate(
202 "Security", 210 "Security",
203 "Using '{0}' to parse untrusted XML data is known to be vulnerable" 211 "Using '{0}' to parse untrusted XML data is known to be vulnerable"
204 " to XML attacks. Replace '{0}' with the equivalent defusedxml" 212 " to XML attacks. Replace '{0}' with the equivalent defusedxml"
205 " package, or make sure defusedxml.defuse_stdlib() is called."), 213 " package, or make sure defusedxml.defuse_stdlib() is called.",
214 ),
206 "S407": QCoreApplication.translate( 215 "S407": QCoreApplication.translate(
207 "Security", 216 "Security",
208 "Using '{0}' to parse untrusted XML data is known to be vulnerable" 217 "Using '{0}' to parse untrusted XML data is known to be vulnerable"
209 " to XML attacks. Replace '{0}' with the equivalent defusedxml" 218 " to XML attacks. Replace '{0}' with the equivalent defusedxml"
210 " package, or make sure defusedxml.defuse_stdlib() is called."), 219 " package, or make sure defusedxml.defuse_stdlib() is called.",
220 ),
211 "S408": QCoreApplication.translate( 221 "S408": QCoreApplication.translate(
212 "Security", 222 "Security",
213 "Using '{0}' to parse untrusted XML data is known to be vulnerable" 223 "Using '{0}' to parse untrusted XML data is known to be vulnerable"
214 " to XML attacks. Replace '{0}' with the equivalent defusedxml" 224 " to XML attacks. Replace '{0}' with the equivalent defusedxml"
215 " package, or make sure defusedxml.defuse_stdlib() is called."), 225 " package, or make sure defusedxml.defuse_stdlib() is called.",
226 ),
216 "S409": QCoreApplication.translate( 227 "S409": QCoreApplication.translate(
217 "Security", 228 "Security",
218 "Using '{0}' to parse untrusted XML data is known to be vulnerable" 229 "Using '{0}' to parse untrusted XML data is known to be vulnerable"
219 " to XML attacks. Replace '{0}' with the equivalent defusedxml" 230 " to XML attacks. Replace '{0}' with the equivalent defusedxml"
220 " package, or make sure defusedxml.defuse_stdlib() is called."), 231 " package, or make sure defusedxml.defuse_stdlib() is called.",
232 ),
221 "S410": QCoreApplication.translate( 233 "S410": QCoreApplication.translate(
222 "Security", 234 "Security",
223 "Using '{0}' to parse untrusted XML data is known to be vulnerable" 235 "Using '{0}' to parse untrusted XML data is known to be vulnerable"
224 " to XML attacks. Replace '{0}' with the equivalent defusedxml" 236 " to XML attacks. Replace '{0}' with the equivalent defusedxml"
225 " package."), 237 " package.",
238 ),
226 "S411": QCoreApplication.translate( 239 "S411": QCoreApplication.translate(
227 "Security", 240 "Security",
228 "Using '{0}' to parse untrusted XML data is known to be vulnerable" 241 "Using '{0}' to parse untrusted XML data is known to be vulnerable"
229 " to XML attacks. Use defused.xmlrpc.monkey_patch() function to" 242 " to XML attacks. Use defused.xmlrpc.monkey_patch() function to"
230 " monkey-patch xmlrpclib and mitigate XML vulnerabilities."), 243 " monkey-patch xmlrpclib and mitigate XML vulnerabilities.",
244 ),
231 "S412": QCoreApplication.translate( 245 "S412": QCoreApplication.translate(
232 "Security", 246 "Security",
233 "Consider possible security implications associated with '{0}'" 247 "Consider possible security implications associated with '{0}'" " module.",
234 " module."), 248 ),
235 "S413": QCoreApplication.translate( 249 "S413": QCoreApplication.translate(
236 "Security", 250 "Security",
237 "The pyCrypto library and its module '{0}' are no longer actively" 251 "The pyCrypto library and its module '{0}' are no longer actively"
238 " maintained and have been deprecated. Consider using" 252 " maintained and have been deprecated. Consider using"
239 " pyca/cryptography library."), 253 " pyca/cryptography library.",
240 254 ),
241 # insecure certificate usage 255 # insecure certificate usage
242 "S501": QCoreApplication.translate( 256 "S501": QCoreApplication.translate(
243 "Security", 257 "Security",
244 "'requests' call with verify=False disabling SSL certificate checks," 258 "'requests' call with verify=False disabling SSL certificate checks,"
245 " security issue."), 259 " security issue.",
246 260 ),
247 # insecure SSL/TLS protocol version 261 # insecure SSL/TLS protocol version
248 "S502.1": QCoreApplication.translate( 262 "S502.1": QCoreApplication.translate(
249 "Security", 263 "Security",
250 "'ssl.wrap_socket' call with insecure SSL/TLS protocol version" 264 "'ssl.wrap_socket' call with insecure SSL/TLS protocol version"
251 " identified, security issue."), 265 " identified, security issue.",
266 ),
252 "S502.2": QCoreApplication.translate( 267 "S502.2": QCoreApplication.translate(
253 "Security", 268 "Security",
254 "'SSL.Context' call with insecure SSL/TLS protocol version identified," 269 "'SSL.Context' call with insecure SSL/TLS protocol version identified,"
255 " security issue."), 270 " security issue.",
271 ),
256 "S502.3": QCoreApplication.translate( 272 "S502.3": QCoreApplication.translate(
257 "Security", 273 "Security",
258 "Function call with insecure SSL/TLS protocol version identified," 274 "Function call with insecure SSL/TLS protocol version identified,"
259 " security issue."), 275 " security issue.",
276 ),
260 "S503": QCoreApplication.translate( 277 "S503": QCoreApplication.translate(
261 "Security", 278 "Security",
262 "Function definition identified with insecure SSL/TLS protocol" 279 "Function definition identified with insecure SSL/TLS protocol"
263 " version by default, possible security issue."), 280 " version by default, possible security issue.",
281 ),
264 "S504": QCoreApplication.translate( 282 "S504": QCoreApplication.translate(
265 "Security", 283 "Security",
266 "'ssl.wrap_socket' call with no SSL/TLS protocol version specified," 284 "'ssl.wrap_socket' call with no SSL/TLS protocol version specified,"
267 " the default 'SSLv23' could be insecure, possible security issue."), 285 " the default 'SSLv23' could be insecure, possible security issue.",
268 286 ),
269 # weak cryptographic keys 287 # weak cryptographic keys
270 "S505": QCoreApplication.translate( 288 "S505": QCoreApplication.translate(
271 "Security", 289 "Security", "{0} key sizes below {1:d} bits are considered breakable."
272 "{0} key sizes below {1:d} bits are considered breakable."), 290 ),
273
274 # YAML load 291 # YAML load
275 "S506": QCoreApplication.translate( 292 "S506": QCoreApplication.translate(
276 "Security", 293 "Security",
277 "Use of unsafe 'yaml.load()'. Allows instantiation of arbitrary" 294 "Use of unsafe 'yaml.load()'. Allows instantiation of arbitrary"
278 " objects. Consider 'yaml.safe_load()'."), 295 " objects. Consider 'yaml.safe_load()'.",
279 296 ),
280 # SSH host key verification 297 # SSH host key verification
281 "S507": QCoreApplication.translate( 298 "S507": QCoreApplication.translate(
282 "Security", 299 "Security",
283 "Paramiko call with policy set to automatically trust the unknown" 300 "Paramiko call with policy set to automatically trust the unknown" " host key.",
284 " host key."), 301 ),
285
286 # Shell injection 302 # Shell injection
287 "S601": QCoreApplication.translate( 303 "S601": QCoreApplication.translate(
288 "Security", 304 "Security",
289 "Possible shell injection via 'Paramiko' call, check inputs are" 305 "Possible shell injection via 'Paramiko' call, check inputs are"
290 " properly sanitized."), 306 " properly sanitized.",
307 ),
291 "S602.L": QCoreApplication.translate( 308 "S602.L": QCoreApplication.translate(
292 "Security", 309 "Security",
293 "'subprocess' call with shell=True seems safe, but may be changed" 310 "'subprocess' call with shell=True seems safe, but may be changed"
294 " in the future, consider rewriting without shell"), 311 " in the future, consider rewriting without shell",
312 ),
295 "S602.H": QCoreApplication.translate( 313 "S602.H": QCoreApplication.translate(
296 "Security", 314 "Security", "'subprocess' call with shell=True identified, security issue."
297 "'subprocess' call with shell=True identified, security issue."), 315 ),
298 "S603": QCoreApplication.translate( 316 "S603": QCoreApplication.translate(
299 "Security", 317 "Security", "'subprocess' call - check for execution of untrusted input."
300 "'subprocess' call - check for execution of untrusted input."), 318 ),
301 "S604": QCoreApplication.translate( 319 "S604": QCoreApplication.translate(
302 "Security", 320 "Security",
303 "Function call with shell=True parameter identified, possible" 321 "Function call with shell=True parameter identified, possible"
304 " security issue."), 322 " security issue.",
323 ),
305 "S605.L": QCoreApplication.translate( 324 "S605.L": QCoreApplication.translate(
306 "Security", 325 "Security",
307 "Starting a process with a shell: Seems safe, but may be changed in" 326 "Starting a process with a shell: Seems safe, but may be changed in"
308 " the future, consider rewriting without shell"), 327 " the future, consider rewriting without shell",
328 ),
309 "S605.H": QCoreApplication.translate( 329 "S605.H": QCoreApplication.translate(
310 "Security", 330 "Security",
311 "Starting a process with a shell, possible injection detected," 331 "Starting a process with a shell, possible injection detected,"
312 " security issue."), 332 " security issue.",
333 ),
313 "S606": QCoreApplication.translate( 334 "S606": QCoreApplication.translate(
314 "Security", 335 "Security", "Starting a process without a shell."
315 "Starting a process without a shell."), 336 ),
316 "S607": QCoreApplication.translate( 337 "S607": QCoreApplication.translate(
317 "Security", 338 "Security", "Starting a process with a partial executable path."
318 "Starting a process with a partial executable path."), 339 ),
319
320 # SQL injection 340 # SQL injection
321 "S608": QCoreApplication.translate( 341 "S608": QCoreApplication.translate(
322 "Security", 342 "Security",
323 "Possible SQL injection vector through string-based query" 343 "Possible SQL injection vector through string-based query" " construction.",
324 " construction."), 344 ),
325
326 # Wildcard injection 345 # Wildcard injection
327 "S609": QCoreApplication.translate( 346 "S609": QCoreApplication.translate(
328 "Security", 347 "Security", "Possible wildcard injection in call: {0}"
329 "Possible wildcard injection in call: {0}"), 348 ),
330
331 # Django SQL injection 349 # Django SQL injection
332 "S610": QCoreApplication.translate( 350 "S610": QCoreApplication.translate(
333 "Security", 351 "Security", "Use of 'extra()' opens a potential SQL attack vector."
334 "Use of 'extra()' opens a potential SQL attack vector."), 352 ),
335 "S611": QCoreApplication.translate( 353 "S611": QCoreApplication.translate(
336 "Security", 354 "Security", "Use of 'RawSQL()' opens a potential SQL attack vector."
337 "Use of 'RawSQL()' opens a potential SQL attack vector."), 355 ),
338
339 # Jinja2 templates 356 # Jinja2 templates
340 "S701.1": QCoreApplication.translate( 357 "S701.1": QCoreApplication.translate(
341 "Security", 358 "Security",
342 "Using jinja2 templates with 'autoescape=False' is dangerous and can" 359 "Using jinja2 templates with 'autoescape=False' is dangerous and can"
343 " lead to XSS. Use 'autoescape=True' or use the 'select_autoescape'" 360 " lead to XSS. Use 'autoescape=True' or use the 'select_autoescape'"
344 " function to mitigate XSS vulnerabilities."), 361 " function to mitigate XSS vulnerabilities.",
362 ),
345 "S701.2": QCoreApplication.translate( 363 "S701.2": QCoreApplication.translate(
346 "Security", 364 "Security",
347 "By default, jinja2 sets 'autoescape' to False. Consider using" 365 "By default, jinja2 sets 'autoescape' to False. Consider using"
348 " 'autoescape=True' or use the 'select_autoescape' function to" 366 " 'autoescape=True' or use the 'select_autoescape' function to"
349 " mitigate XSS vulnerabilities."), 367 " mitigate XSS vulnerabilities.",
350 368 ),
351 # Mako templates 369 # Mako templates
352 "S702": QCoreApplication.translate( 370 "S702": QCoreApplication.translate(
353 "Security", 371 "Security",
354 "Mako templates allow HTML/JS rendering by default and are inherently" 372 "Mako templates allow HTML/JS rendering by default and are inherently"
355 " open to XSS attacks. Ensure variables in all templates are properly" 373 " open to XSS attacks. Ensure variables in all templates are properly"
356 " sanitized via the 'n', 'h' or 'x' flags (depending on context). For" 374 " sanitized via the 'n', 'h' or 'x' flags (depending on context). For"
357 " example, to HTML escape the variable 'data' do ${{ data |h }}."), 375 " example, to HTML escape the variable 'data' do ${{ data |h }}.",
358 376 ),
359 # Django XSS vulnerability 377 # Django XSS vulnerability
360 "S703": QCoreApplication.translate( 378 "S703": QCoreApplication.translate(
361 "Security", 379 "Security", "Potential XSS on 'mark_safe()' function."
362 "Potential XSS on 'mark_safe()' function."), 380 ),
363
364 # hardcoded AWS passwords 381 # hardcoded AWS passwords
365 "S801": QCoreApplication.translate( 382 "S801": QCoreApplication.translate(
366 "Security", 383 "Security", "Possible hardcoded AWS access key ID: {0}"
367 "Possible hardcoded AWS access key ID: {0}"), 384 ),
368 "S802": QCoreApplication.translate( 385 "S802": QCoreApplication.translate(
369 "Security", 386 "Security", "Possible hardcoded AWS secret access key: {0}"
370 "Possible hardcoded AWS secret access key: {0}"), 387 ),
371 } 388 }
372 389
373 _securityMessagesSampleArgs = { 390 _securityMessagesSampleArgs = {
374 "S103": ["0o777", "testfile.txt"], 391 "S103": ["0o777", "testfile.txt"],
375 "S105": ["password"], 392 "S105": ["password"],
376 "S106": ["password"], 393 "S106": ["password"],
377 "S107": ["password"], 394 "S107": ["password"],
378
379 "S304": ["Crypto.Cipher.DES"], 395 "S304": ["Crypto.Cipher.DES"],
380 "S305": ["cryptography.hazmat.primitives.ciphers.modes.ECB"], 396 "S305": ["cryptography.hazmat.primitives.ciphers.modes.ECB"],
381 "S313": ["xml.etree.cElementTree.parse"], 397 "S313": ["xml.etree.cElementTree.parse"],
382 "S314": ["xml.etree.ElementTree.parse"], 398 "S314": ["xml.etree.ElementTree.parse"],
383 "S315": ["xml.sax.expatreader.create_parser"], 399 "S315": ["xml.sax.expatreader.create_parser"],
384 "S316": ["xml.dom.expatbuilder.parse"], 400 "S316": ["xml.dom.expatbuilder.parse"],
385 "S317": ["xml.sax.parse"], 401 "S317": ["xml.sax.parse"],
386 "S318": ["xml.dom.minidom.parse"], 402 "S318": ["xml.dom.minidom.parse"],
387 "S319": ["xml.dom.pulldom.parse"], 403 "S319": ["xml.dom.pulldom.parse"],
388 "S320": ["lxml.etree.parse"], 404 "S320": ["lxml.etree.parse"],
389
390 "S331": ["MD5"], 405 "S331": ["MD5"],
391
392 "S403": ["pickle"], 406 "S403": ["pickle"],
393 "S404": ["subprocess"], 407 "S404": ["subprocess"],
394 "S405": ["xml.etree.ElementTree"], 408 "S405": ["xml.etree.ElementTree"],
395 "S406": ["xml.sax"], 409 "S406": ["xml.sax"],
396 "S407": ["xml.dom.expatbuilder"], 410 "S407": ["xml.dom.expatbuilder"],
398 "S409": ["xml.dom.pulldom"], 412 "S409": ["xml.dom.pulldom"],
399 "S410": ["lxml"], 413 "S410": ["lxml"],
400 "S411": ["xmlrpclib"], 414 "S411": ["xmlrpclib"],
401 "S412": ["wsgiref.handlers.CGIHandler"], 415 "S412": ["wsgiref.handlers.CGIHandler"],
402 "S413": ["Crypto.Cipher"], 416 "S413": ["Crypto.Cipher"],
403
404 "S505": ["RSA", 2048], 417 "S505": ["RSA", 2048],
405
406 "S609": ["os.system"], 418 "S609": ["os.system"],
407 419 "S801": ["A1B2C3D4E5F6G7H8I9J0"], # secok
408 "S801": ["A1B2C3D4E5F6G7H8I9J0"], # secok 420 "S802": ["aA1bB2cC3dD4/eE5fF6gG7+hH8iI9jJ0=kKlLM+="], # secok
409 "S802": ["aA1bB2cC3dD4/eE5fF6gG7+hH8iI9jJ0=kKlLM+="], # secok
410 } 421 }

eric ide

mercurial