5 <link rel="stylesheet" href="styles.css"> |
5 <link rel="stylesheet" href="styles.css"> |
6 </head> |
6 </head> |
7 <body> |
7 <body> |
8 <a NAME="top" ID="top"></a> |
8 <a NAME="top" ID="top"></a> |
9 <h1>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityNodeVisitor</h1> |
9 <h1>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityNodeVisitor</h1> |
10 |
|
11 <p> |
10 <p> |
12 Module implementing an AST node visitor for security checks. |
11 Module implementing an AST node visitor for security checks. |
13 </p> |
12 </p> |
|
13 |
14 <h3>Global Attributes</h3> |
14 <h3>Global Attributes</h3> |
15 |
15 <table> |
16 <table> |
16 <tr><td>None</td></tr> |
17 <tr><td>None</td></tr> |
17 </table> |
18 </table> |
18 |
19 <h3>Classes</h3> |
19 <h3>Classes</h3> |
20 |
20 <table> |
21 <table> |
|
22 |
|
23 <tr> |
21 <tr> |
24 <td><a href="#SecurityNodeVisitor">SecurityNodeVisitor</a></td> |
22 <td><a href="#SecurityNodeVisitor">SecurityNodeVisitor</a></td> |
25 <td>Class implementing an AST node visitor for security checks.</td> |
23 <td>Class implementing an AST node visitor for security checks.</td> |
26 </tr> |
24 </tr> |
27 </table> |
25 </table> |
|
26 |
28 <h3>Functions</h3> |
27 <h3>Functions</h3> |
29 |
28 <table> |
30 <table> |
29 <tr><td>None</td></tr> |
31 <tr><td>None</td></tr> |
30 </table> |
32 </table> |
31 |
33 <hr /> |
32 <hr /> |
34 <hr /> |
33 <hr /> |
35 <a NAME="SecurityNodeVisitor" ID="SecurityNodeVisitor"></a> |
34 <a NAME="SecurityNodeVisitor" ID="SecurityNodeVisitor"></a> |
36 <h2>SecurityNodeVisitor</h2> |
35 <h2>SecurityNodeVisitor</h2> |
37 |
|
38 <p> |
36 <p> |
39 Class implementing an AST node visitor for security checks. |
37 Class implementing an AST node visitor for security checks. |
40 </p> |
38 </p> |
|
39 |
41 <h3>Derived from</h3> |
40 <h3>Derived from</h3> |
42 None |
41 None |
43 <h3>Class Attributes</h3> |
42 <h3>Class Attributes</h3> |
44 |
43 <table> |
45 <table> |
44 <tr><td>None</td></tr> |
46 <tr><td>None</td></tr> |
45 </table> |
47 </table> |
46 |
48 <h3>Class Methods</h3> |
47 <h3>Class Methods</h3> |
49 |
48 <table> |
50 <table> |
49 <tr><td>None</td></tr> |
51 <tr><td>None</td></tr> |
50 </table> |
52 </table> |
51 |
53 <h3>Methods</h3> |
52 <h3>Methods</h3> |
54 |
53 <table> |
55 <table> |
|
56 |
|
57 <tr> |
54 <tr> |
58 <td><a href="#SecurityNodeVisitor.__init__">SecurityNodeVisitor</a></td> |
55 <td><a href="#SecurityNodeVisitor.__init__">SecurityNodeVisitor</a></td> |
59 <td>Constructor</td> |
56 <td>Constructor</td> |
60 </tr> |
57 </tr> |
61 <tr> |
58 <tr> |
180 </dd> |
178 </dd> |
181 </dl> |
179 </dl> |
182 <a NAME="SecurityNodeVisitor.__runChecks" ID="SecurityNodeVisitor.__runChecks"></a> |
180 <a NAME="SecurityNodeVisitor.__runChecks" ID="SecurityNodeVisitor.__runChecks"></a> |
183 <h4>SecurityNodeVisitor.__runChecks</h4> |
181 <h4>SecurityNodeVisitor.__runChecks</h4> |
184 <b>__runChecks</b>(<i>checkType</i>) |
182 <b>__runChecks</b>(<i>checkType</i>) |
185 |
|
186 <p> |
183 <p> |
187 Private method to run all enabled checks for a given check type. |
184 Private method to run all enabled checks for a given check type. |
188 </p> |
185 </p> |
|
186 |
189 <dl> |
187 <dl> |
190 |
188 |
191 <dt><i>checkType</i> (str)</dt> |
189 <dt><i>checkType</i> (str)</dt> |
192 <dd> |
190 <dd> |
193 type of checks to be run |
191 type of checks to be run |
194 </dd> |
192 </dd> |
195 </dl> |
193 </dl> |
196 <a NAME="SecurityNodeVisitor.__visitFunctionDefinition" ID="SecurityNodeVisitor.__visitFunctionDefinition"></a> |
194 <a NAME="SecurityNodeVisitor.__visitFunctionDefinition" ID="SecurityNodeVisitor.__visitFunctionDefinition"></a> |
197 <h4>SecurityNodeVisitor.__visitFunctionDefinition</h4> |
195 <h4>SecurityNodeVisitor.__visitFunctionDefinition</h4> |
198 <b>__visitFunctionDefinition</b>(<i>node</i>) |
196 <b>__visitFunctionDefinition</b>(<i>node</i>) |
199 |
|
200 <p> |
197 <p> |
201 Private method defining a visitor for AST FunctionDef and |
198 Private method defining a visitor for AST FunctionDef and |
202 AsyncFunctionDef nodes. |
199 AsyncFunctionDef nodes. |
203 </p> |
200 </p> |
204 <p> |
201 <p> |
205 Add relevant information about the node to the context for use in tests |
202 Add relevant information about the node to the context for use in tests |
206 which inspect function definitions. Add the function name to the |
203 which inspect function definitions. Add the function name to the |
207 current namespace for all descendants. |
204 current namespace for all descendants. |
208 </p> |
205 </p> |
|
206 |
209 <dl> |
207 <dl> |
210 |
208 |
211 <dt><i>node</i> (ast.FunctionDef, ast.AsyncFunctionDef)</dt> |
209 <dt><i>node</i> (ast.FunctionDef, ast.AsyncFunctionDef)</dt> |
212 <dd> |
210 <dd> |
213 reference to the node being inspected |
211 reference to the node being inspected |
214 </dd> |
212 </dd> |
215 </dl> |
213 </dl> |
216 <a NAME="SecurityNodeVisitor.generic_visit" ID="SecurityNodeVisitor.generic_visit"></a> |
214 <a NAME="SecurityNodeVisitor.generic_visit" ID="SecurityNodeVisitor.generic_visit"></a> |
217 <h4>SecurityNodeVisitor.generic_visit</h4> |
215 <h4>SecurityNodeVisitor.generic_visit</h4> |
218 <b>generic_visit</b>(<i>node</i>) |
216 <b>generic_visit</b>(<i>node</i>) |
219 |
|
220 <p> |
217 <p> |
221 Public method to drive the node visitor. |
218 Public method to drive the node visitor. |
222 </p> |
219 </p> |
|
220 |
223 <dl> |
221 <dl> |
224 |
222 |
225 <dt><i>node</i> (ast.AST)</dt> |
223 <dt><i>node</i> (ast.AST)</dt> |
226 <dd> |
224 <dd> |
227 node to be inspected |
225 node to be inspected |
228 </dd> |
226 </dd> |
229 </dl> |
227 </dl> |
230 <a NAME="SecurityNodeVisitor.visit" ID="SecurityNodeVisitor.visit"></a> |
228 <a NAME="SecurityNodeVisitor.visit" ID="SecurityNodeVisitor.visit"></a> |
231 <h4>SecurityNodeVisitor.visit</h4> |
229 <h4>SecurityNodeVisitor.visit</h4> |
232 <b>visit</b>(<i>node</i>) |
230 <b>visit</b>(<i>node</i>) |
233 |
|
234 <p> |
231 <p> |
235 Public method to inspected an AST node. |
232 Public method to inspected an AST node. |
236 </p> |
233 </p> |
|
234 |
237 <dl> |
235 <dl> |
238 |
236 |
239 <dt><i>node</i> (ast.AST)</dt> |
237 <dt><i>node</i> (ast.AST)</dt> |
240 <dd> |
238 <dd> |
241 AST node to be inspected |
239 AST node to be inspected |
242 </dd> |
240 </dd> |
243 </dl> |
241 </dl> |
244 <a NAME="SecurityNodeVisitor.visit_AsyncFunctionDef" ID="SecurityNodeVisitor.visit_AsyncFunctionDef"></a> |
242 <a NAME="SecurityNodeVisitor.visit_AsyncFunctionDef" ID="SecurityNodeVisitor.visit_AsyncFunctionDef"></a> |
245 <h4>SecurityNodeVisitor.visit_AsyncFunctionDef</h4> |
243 <h4>SecurityNodeVisitor.visit_AsyncFunctionDef</h4> |
246 <b>visit_AsyncFunctionDef</b>(<i>node</i>) |
244 <b>visit_AsyncFunctionDef</b>(<i>node</i>) |
247 |
|
248 <p> |
245 <p> |
249 Public method defining a visitor for AST AsyncFunctionDef nodes. |
246 Public method defining a visitor for AST AsyncFunctionDef nodes. |
250 </p> |
247 </p> |
|
248 |
251 <dl> |
249 <dl> |
252 |
250 |
253 <dt><i>node</i> (ast.AsyncFunctionDef)</dt> |
251 <dt><i>node</i> (ast.AsyncFunctionDef)</dt> |
254 <dd> |
252 <dd> |
255 reference to the node being inspected |
253 reference to the node being inspected |
256 </dd> |
254 </dd> |
257 </dl> |
255 </dl> |
258 <a NAME="SecurityNodeVisitor.visit_Call" ID="SecurityNodeVisitor.visit_Call"></a> |
256 <a NAME="SecurityNodeVisitor.visit_Call" ID="SecurityNodeVisitor.visit_Call"></a> |
259 <h4>SecurityNodeVisitor.visit_Call</h4> |
257 <h4>SecurityNodeVisitor.visit_Call</h4> |
260 <b>visit_Call</b>(<i>node</i>) |
258 <b>visit_Call</b>(<i>node</i>) |
261 |
|
262 <p> |
259 <p> |
263 Public method defining a visitor for AST Call nodes. |
260 Public method defining a visitor for AST Call nodes. |
264 </p> |
261 </p> |
265 <p> |
262 <p> |
266 Add relevant information about the node to the context for use in tests |
263 Add relevant information about the node to the context for use in tests |
267 which inspect function calls. |
264 which inspect function calls. |
268 </p> |
265 </p> |
|
266 |
269 <dl> |
267 <dl> |
270 |
268 |
271 <dt><i>node</i> (ast.Call)</dt> |
269 <dt><i>node</i> (ast.Call)</dt> |
272 <dd> |
270 <dd> |
273 reference to the node being inspected |
271 reference to the node being inspected |
274 </dd> |
272 </dd> |
275 </dl> |
273 </dl> |
276 <a NAME="SecurityNodeVisitor.visit_ClassDef" ID="SecurityNodeVisitor.visit_ClassDef"></a> |
274 <a NAME="SecurityNodeVisitor.visit_ClassDef" ID="SecurityNodeVisitor.visit_ClassDef"></a> |
277 <h4>SecurityNodeVisitor.visit_ClassDef</h4> |
275 <h4>SecurityNodeVisitor.visit_ClassDef</h4> |
278 <b>visit_ClassDef</b>(<i>node</i>) |
276 <b>visit_ClassDef</b>(<i>node</i>) |
279 |
|
280 <p> |
277 <p> |
281 Public method defining a visitor for AST ClassDef nodes. |
278 Public method defining a visitor for AST ClassDef nodes. |
282 </p> |
279 </p> |
283 <p> |
280 <p> |
284 Add class name to current namespace for all descendants. |
281 Add class name to current namespace for all descendants. |
285 </p> |
282 </p> |
|
283 |
286 <dl> |
284 <dl> |
287 |
285 |
288 <dt><i>node</i> (ast.ClassDef)</dt> |
286 <dt><i>node</i> (ast.ClassDef)</dt> |
289 <dd> |
287 <dd> |
290 reference to the node being inspected |
288 reference to the node being inspected |
291 </dd> |
289 </dd> |
292 </dl> |
290 </dl> |
293 <a NAME="SecurityNodeVisitor.visit_Constant" ID="SecurityNodeVisitor.visit_Constant"></a> |
291 <a NAME="SecurityNodeVisitor.visit_Constant" ID="SecurityNodeVisitor.visit_Constant"></a> |
294 <h4>SecurityNodeVisitor.visit_Constant</h4> |
292 <h4>SecurityNodeVisitor.visit_Constant</h4> |
295 <b>visit_Constant</b>(<i>node</i>) |
293 <b>visit_Constant</b>(<i>node</i>) |
296 |
|
297 <p> |
294 <p> |
298 Public method defining a visitor for Constant nodes. |
295 Public method defining a visitor for Constant nodes. |
299 </p> |
296 </p> |
300 <p> |
297 <p> |
301 This calls the appropriate method for the node type. |
298 This calls the appropriate method for the node type. |
302 It maintains compatibility with <3.6 and 3.8+ |
299 It maintains compatibility with <3.6 and 3.8+ |
303 </p> |
300 </p> |
|
301 |
304 <dl> |
302 <dl> |
305 |
303 |
306 <dt><i>node</i> (ast.Constant)</dt> |
304 <dt><i>node</i> (ast.Constant)</dt> |
307 <dd> |
305 <dd> |
308 reference to the node being inspected |
306 reference to the node being inspected |
309 </dd> |
307 </dd> |
310 </dl> |
308 </dl> |
311 <a NAME="SecurityNodeVisitor.visit_FunctionDef" ID="SecurityNodeVisitor.visit_FunctionDef"></a> |
309 <a NAME="SecurityNodeVisitor.visit_FunctionDef" ID="SecurityNodeVisitor.visit_FunctionDef"></a> |
312 <h4>SecurityNodeVisitor.visit_FunctionDef</h4> |
310 <h4>SecurityNodeVisitor.visit_FunctionDef</h4> |
313 <b>visit_FunctionDef</b>(<i>node</i>) |
311 <b>visit_FunctionDef</b>(<i>node</i>) |
314 |
|
315 <p> |
312 <p> |
316 Public method defining a visitor for AST FunctionDef nodes. |
313 Public method defining a visitor for AST FunctionDef nodes. |
317 </p> |
314 </p> |
|
315 |
318 <dl> |
316 <dl> |
319 |
317 |
320 <dt><i>node</i> (ast.FunctionDef)</dt> |
318 <dt><i>node</i> (ast.FunctionDef)</dt> |
321 <dd> |
319 <dd> |
322 reference to the node being inspected |
320 reference to the node being inspected |
323 </dd> |
321 </dd> |
324 </dl> |
322 </dl> |
325 <a NAME="SecurityNodeVisitor.visit_Import" ID="SecurityNodeVisitor.visit_Import"></a> |
323 <a NAME="SecurityNodeVisitor.visit_Import" ID="SecurityNodeVisitor.visit_Import"></a> |
326 <h4>SecurityNodeVisitor.visit_Import</h4> |
324 <h4>SecurityNodeVisitor.visit_Import</h4> |
327 <b>visit_Import</b>(<i>node</i>) |
325 <b>visit_Import</b>(<i>node</i>) |
328 |
|
329 <p> |
326 <p> |
330 Public method defining a visitor for AST Import nodes. |
327 Public method defining a visitor for AST Import nodes. |
331 </p> |
328 </p> |
|
329 |
332 <dl> |
330 <dl> |
333 |
331 |
334 <dt><i>node</i> (ast.Import)</dt> |
332 <dt><i>node</i> (ast.Import)</dt> |
335 <dd> |
333 <dd> |
336 reference to the node being inspected |
334 reference to the node being inspected |
337 </dd> |
335 </dd> |
338 </dl> |
336 </dl> |
339 <a NAME="SecurityNodeVisitor.visit_ImportFrom" ID="SecurityNodeVisitor.visit_ImportFrom"></a> |
337 <a NAME="SecurityNodeVisitor.visit_ImportFrom" ID="SecurityNodeVisitor.visit_ImportFrom"></a> |
340 <h4>SecurityNodeVisitor.visit_ImportFrom</h4> |
338 <h4>SecurityNodeVisitor.visit_ImportFrom</h4> |
341 <b>visit_ImportFrom</b>(<i>node</i>) |
339 <b>visit_ImportFrom</b>(<i>node</i>) |
342 |
|
343 <p> |
340 <p> |
344 Public method defining a visitor for AST Import nodes. |
341 Public method defining a visitor for AST Import nodes. |
345 </p> |
342 </p> |
346 <p> |
343 <p> |
347 This adds relevant information about the node to |
344 This adds relevant information about the node to |
348 the context for use in tests which inspect imports. |
345 the context for use in tests which inspect imports. |
349 </p> |
346 </p> |
|
347 |
350 <dl> |
348 <dl> |
351 |
349 |
352 <dt><i>node</i> (ast.ImportFrom)</dt> |
350 <dt><i>node</i> (ast.ImportFrom)</dt> |
353 <dd> |
351 <dd> |
354 reference to the node being inspected |
352 reference to the node being inspected |