eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityContext.html

branch
eric7
changeset 8372
e0227a7c850e
child 8596
d64760b2da50
equal deleted inserted replaced
8371:d6062691d424 8372:e0227a7c850e
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityContext</title>
4 <meta charset="UTF-8">
5 <style>
6 body {
7 background: #EDECE6;
8 margin: 0em 1em 10em 1em;
9 color: black;
10 }
11
12 h1 { color: white; background: #85774A; }
13 h2 { color: white; background: #85774A; }
14 h3 { color: white; background: #9D936E; }
15 h4 { color: white; background: #9D936E; }
16
17 a { color: #BA6D36; }
18
19 </style>
20 </head>
21 <body>
22 <a NAME="top" ID="top"></a>
23 <h1>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityContext</h1>
24
25 <p>
26 Module implementing a context class for security related checks.
27 </p>
28 <h3>Global Attributes</h3>
29
30 <table>
31 <tr><td>None</td></tr>
32 </table>
33 <h3>Classes</h3>
34
35 <table>
36
37 <tr>
38 <td><a href="#SecurityContext">SecurityContext</a></td>
39 <td>Class implementing a context class for security related checks.</td>
40 </tr>
41 </table>
42 <h3>Functions</h3>
43
44 <table>
45 <tr><td>None</td></tr>
46 </table>
47 <hr />
48 <hr />
49 <a NAME="SecurityContext" ID="SecurityContext"></a>
50 <h2>SecurityContext</h2>
51
52 <p>
53 Class implementing a context class for security related checks.
54 </p>
55 <h3>Derived from</h3>
56 None
57 <h3>Class Attributes</h3>
58
59 <table>
60 <tr><td>None</td></tr>
61 </table>
62 <h3>Class Methods</h3>
63
64 <table>
65 <tr><td>None</td></tr>
66 </table>
67 <h3>Methods</h3>
68
69 <table>
70
71 <tr>
72 <td><a href="#SecurityContext.__init__">SecurityContext</a></td>
73 <td>Constructor</td>
74 </tr>
75 <tr>
76 <td><a href="#SecurityContext.__getLiteralValue">__getLiteralValue</a></td>
77 <td>Private method to turn AST literals into native Python types.</td>
78 </tr>
79 <tr>
80 <td><a href="#SecurityContext.__repr__">__repr__</a></td>
81 <td>Special method to generate representation of object for printing or interactive use.</td>
82 </tr>
83 <tr>
84 <td><a href="#SecurityContext.bytesVal">bytesVal</a></td>
85 <td>Public method to get the value of a standalone bytes object.</td>
86 </tr>
87 <tr>
88 <td><a href="#SecurityContext.callArgs">callArgs</a></td>
89 <td>Public method to get a list of function args.</td>
90 </tr>
91 <tr>
92 <td><a href="#SecurityContext.callArgsCount">callArgsCount</a></td>
93 <td>Public method to get the number of args a function call has.</td>
94 </tr>
95 <tr>
96 <td><a href="#SecurityContext.callFunctionName">callFunctionName</a></td>
97 <td>Public method to get the name (not FQ) of a function call.</td>
98 </tr>
99 <tr>
100 <td><a href="#SecurityContext.callFunctionNameQual">callFunctionNameQual</a></td>
101 <td>Public method to get the FQ name of a function call.</td>
102 </tr>
103 <tr>
104 <td><a href="#SecurityContext.callKeywords">callKeywords</a></td>
105 <td>Public method to get a dictionary of keyword parameters.</td>
106 </tr>
107 <tr>
108 <td><a href="#SecurityContext.checkCallArgValue">checkCallArgValue</a></td>
109 <td>Public method to check for a value of a named argument in a function call.</td>
110 </tr>
111 <tr>
112 <td><a href="#SecurityContext.functionDefDefaultsQual">functionDefDefaultsQual</a></td>
113 <td>Public method to get a list of fully qualified default values in a function def.</td>
114 </tr>
115 <tr>
116 <td><a href="#SecurityContext.getCallArgAtPosition">getCallArgAtPosition</a></td>
117 <td>Public method to get a positional argument at the specified position (if it exists).</td>
118 </tr>
119 <tr>
120 <td><a href="#SecurityContext.getCallArgValue">getCallArgValue</a></td>
121 <td>Public method to get the value of a named argument in a function call.</td>
122 </tr>
123 <tr>
124 <td><a href="#SecurityContext.getLinenoForCallArg">getLinenoForCallArg</a></td>
125 <td>Public method to get the line number for a specific named argument.</td>
126 </tr>
127 <tr>
128 <td><a href="#SecurityContext.getOffsetForCallArg">getOffsetForCallArg</a></td>
129 <td>Public method to get the offset for a specific named argument.</td>
130 </tr>
131 <tr>
132 <td><a href="#SecurityContext.isModuleBeingImported">isModuleBeingImported</a></td>
133 <td>Public method to check for the given module is currently being imported.</td>
134 </tr>
135 <tr>
136 <td><a href="#SecurityContext.isModuleImportedExact">isModuleImportedExact</a></td>
137 <td>Public method to check if a given module has been imported; only exact matches.</td>
138 </tr>
139 <tr>
140 <td><a href="#SecurityContext.isModuleImportedLike">isModuleImportedLike</a></td>
141 <td>Public method to check if a given module has been imported; given module exists.</td>
142 </tr>
143 <tr>
144 <td><a href="#SecurityContext.node">node</a></td>
145 <td>Public method to get the raw AST node associated with the context.</td>
146 </tr>
147 <tr>
148 <td><a href="#SecurityContext.statement">statement</a></td>
149 <td>Public method to get the raw AST for the current statement.</td>
150 </tr>
151 <tr>
152 <td><a href="#SecurityContext.stringVal">stringVal</a></td>
153 <td>Public method to get the value of a standalone string object.</td>
154 </tr>
155 <tr>
156 <td><a href="#SecurityContext.stringValAsEscapedBytes">stringValAsEscapedBytes</a></td>
157 <td>Public method to get the escaped value of the object.</td>
158 </tr>
159 </table>
160 <h3>Static Methods</h3>
161
162 <table>
163 <tr><td>None</td></tr>
164 </table>
165
166 <a NAME="SecurityContext.__init__" ID="SecurityContext.__init__"></a>
167 <h4>SecurityContext (Constructor)</h4>
168 <b>SecurityContext</b>(<i>contextObject=None</i>)
169
170 <p>
171 Constructor
172 </p>
173 <p>
174 Initialize the class with a context dictionary or an empty
175 dictionary.
176 </p>
177 <dl>
178
179 <dt><i>contextObject</i> (dict)</dt>
180 <dd>
181 context dictionary to be used to populate the
182 class
183 </dd>
184 </dl>
185 <a NAME="SecurityContext.__getLiteralValue" ID="SecurityContext.__getLiteralValue"></a>
186 <h4>SecurityContext.__getLiteralValue</h4>
187 <b>__getLiteralValue</b>(<i>literal</i>)
188
189 <p>
190 Private method to turn AST literals into native Python types.
191 </p>
192 <dl>
193
194 <dt><i>literal</i> (ast.AST)</dt>
195 <dd>
196 AST literal to be converted
197 </dd>
198 </dl>
199 <dl>
200 <dt>Return:</dt>
201 <dd>
202 converted Python object
203 </dd>
204 </dl>
205 <dl>
206 <dt>Return Type:</dt>
207 <dd>
208 Any
209 </dd>
210 </dl>
211 <a NAME="SecurityContext.__repr__" ID="SecurityContext.__repr__"></a>
212 <h4>SecurityContext.__repr__</h4>
213 <b>__repr__</b>(<i></i>)
214
215 <p>
216 Special method to generate representation of object for printing or
217 interactive use.
218 </p>
219 <dl>
220 <dt>Return:</dt>
221 <dd>
222 string representation of the object
223 </dd>
224 </dl>
225 <dl>
226 <dt>Return Type:</dt>
227 <dd>
228 str
229 </dd>
230 </dl>
231 <a NAME="SecurityContext.bytesVal" ID="SecurityContext.bytesVal"></a>
232 <h4>SecurityContext.bytesVal</h4>
233 <b>bytesVal</b>(<i></i>)
234
235 <p>
236 Public method to get the value of a standalone bytes object.
237 </p>
238 <dl>
239 <dt>Return:</dt>
240 <dd>
241 value of a standalone bytes object
242 </dd>
243 </dl>
244 <dl>
245 <dt>Return Type:</dt>
246 <dd>
247 bytes
248 </dd>
249 </dl>
250 <a NAME="SecurityContext.callArgs" ID="SecurityContext.callArgs"></a>
251 <h4>SecurityContext.callArgs</h4>
252 <b>callArgs</b>(<i></i>)
253
254 <p>
255 Public method to get a list of function args.
256 </p>
257 <dl>
258 <dt>Return:</dt>
259 <dd>
260 list of function args
261 </dd>
262 </dl>
263 <dl>
264 <dt>Return Type:</dt>
265 <dd>
266 list
267 </dd>
268 </dl>
269 <a NAME="SecurityContext.callArgsCount" ID="SecurityContext.callArgsCount"></a>
270 <h4>SecurityContext.callArgsCount</h4>
271 <b>callArgsCount</b>(<i></i>)
272
273 <p>
274 Public method to get the number of args a function call has.
275 </p>
276 <dl>
277 <dt>Return:</dt>
278 <dd>
279 number of args a function call has
280 </dd>
281 </dl>
282 <dl>
283 <dt>Return Type:</dt>
284 <dd>
285 int
286 </dd>
287 </dl>
288 <a NAME="SecurityContext.callFunctionName" ID="SecurityContext.callFunctionName"></a>
289 <h4>SecurityContext.callFunctionName</h4>
290 <b>callFunctionName</b>(<i></i>)
291
292 <p>
293 Public method to get the name (not FQ) of a function call.
294 </p>
295 <dl>
296 <dt>Return:</dt>
297 <dd>
298 name (not FQ) of a function call
299 </dd>
300 </dl>
301 <dl>
302 <dt>Return Type:</dt>
303 <dd>
304 str
305 </dd>
306 </dl>
307 <a NAME="SecurityContext.callFunctionNameQual" ID="SecurityContext.callFunctionNameQual"></a>
308 <h4>SecurityContext.callFunctionNameQual</h4>
309 <b>callFunctionNameQual</b>(<i></i>)
310
311 <p>
312 Public method to get the FQ name of a function call.
313 </p>
314 <dl>
315 <dt>Return:</dt>
316 <dd>
317 FQ name of a function call
318 </dd>
319 </dl>
320 <dl>
321 <dt>Return Type:</dt>
322 <dd>
323 str
324 </dd>
325 </dl>
326 <a NAME="SecurityContext.callKeywords" ID="SecurityContext.callKeywords"></a>
327 <h4>SecurityContext.callKeywords</h4>
328 <b>callKeywords</b>(<i></i>)
329
330 <p>
331 Public method to get a dictionary of keyword parameters.
332 </p>
333 <dl>
334 <dt>Return:</dt>
335 <dd>
336 dictionary of keyword parameters
337 </dd>
338 </dl>
339 <dl>
340 <dt>Return Type:</dt>
341 <dd>
342 dict
343 </dd>
344 </dl>
345 <a NAME="SecurityContext.checkCallArgValue" ID="SecurityContext.checkCallArgValue"></a>
346 <h4>SecurityContext.checkCallArgValue</h4>
347 <b>checkCallArgValue</b>(<i>argumentName, argumentValues=None</i>)
348
349 <p>
350 Public method to check for a value of a named argument in a function
351 call.
352 </p>
353 <dl>
354
355 <dt><i>argumentName</i> (str)</dt>
356 <dd>
357 name of the argument to be checked
358 </dd>
359 <dt><i>argumentValues</i> (Any or list of Any)</dt>
360 <dd>
361 value or list of values to test against
362 </dd>
363 </dl>
364 <dl>
365 <dt>Return:</dt>
366 <dd>
367 True if argument found and matched, False if found and not
368 matched, None if argument not found at all
369 </dd>
370 </dl>
371 <dl>
372 <dt>Return Type:</dt>
373 <dd>
374 bool or None
375 </dd>
376 </dl>
377 <a NAME="SecurityContext.functionDefDefaultsQual" ID="SecurityContext.functionDefDefaultsQual"></a>
378 <h4>SecurityContext.functionDefDefaultsQual</h4>
379 <b>functionDefDefaultsQual</b>(<i></i>)
380
381 <p>
382 Public method to get a list of fully qualified default values in a
383 function def.
384 </p>
385 <dl>
386 <dt>Return:</dt>
387 <dd>
388 list of fully qualified default values in a function def
389 </dd>
390 </dl>
391 <dl>
392 <dt>Return Type:</dt>
393 <dd>
394 list
395 </dd>
396 </dl>
397 <a NAME="SecurityContext.getCallArgAtPosition" ID="SecurityContext.getCallArgAtPosition"></a>
398 <h4>SecurityContext.getCallArgAtPosition</h4>
399 <b>getCallArgAtPosition</b>(<i>positionNum</i>)
400
401 <p>
402 Public method to get a positional argument at the specified position
403 (if it exists).
404 </p>
405 <dl>
406
407 <dt><i>positionNum</i> (int)</dt>
408 <dd>
409 index of the argument to get the value for
410 </dd>
411 </dl>
412 <dl>
413 <dt>Return:</dt>
414 <dd>
415 value of the argument at the specified position if it exists
416 </dd>
417 </dl>
418 <dl>
419 <dt>Return Type:</dt>
420 <dd>
421 Any or None
422 </dd>
423 </dl>
424 <a NAME="SecurityContext.getCallArgValue" ID="SecurityContext.getCallArgValue"></a>
425 <h4>SecurityContext.getCallArgValue</h4>
426 <b>getCallArgValue</b>(<i>argumentName</i>)
427
428 <p>
429 Public method to get the value of a named argument in a function call.
430 </p>
431 <dl>
432
433 <dt><i>argumentName</i> (str)</dt>
434 <dd>
435 name of the argument to get the value for
436 </dd>
437 </dl>
438 <dl>
439 <dt>Return:</dt>
440 <dd>
441 value of the named argument
442 </dd>
443 </dl>
444 <dl>
445 <dt>Return Type:</dt>
446 <dd>
447 Any
448 </dd>
449 </dl>
450 <a NAME="SecurityContext.getLinenoForCallArg" ID="SecurityContext.getLinenoForCallArg"></a>
451 <h4>SecurityContext.getLinenoForCallArg</h4>
452 <b>getLinenoForCallArg</b>(<i>argumentName</i>)
453
454 <p>
455 Public method to get the line number for a specific named argument.
456 </p>
457 <dl>
458
459 <dt><i>argumentName</i> (str)</dt>
460 <dd>
461 name of the argument to get the line number for
462 </dd>
463 </dl>
464 <dl>
465 <dt>Return:</dt>
466 <dd>
467 line number of the found argument or -1
468 </dd>
469 </dl>
470 <dl>
471 <dt>Return Type:</dt>
472 <dd>
473 int
474 </dd>
475 </dl>
476 <a NAME="SecurityContext.getOffsetForCallArg" ID="SecurityContext.getOffsetForCallArg"></a>
477 <h4>SecurityContext.getOffsetForCallArg</h4>
478 <b>getOffsetForCallArg</b>(<i>argumentName</i>)
479
480 <p>
481 Public method to get the offset for a specific named argument.
482 </p>
483 <dl>
484
485 <dt><i>argumentName</i> (str)</dt>
486 <dd>
487 name of the argument to get the line number for
488 </dd>
489 </dl>
490 <dl>
491 <dt>Return:</dt>
492 <dd>
493 offset of the found argument or -1
494 </dd>
495 </dl>
496 <dl>
497 <dt>Return Type:</dt>
498 <dd>
499 int
500 </dd>
501 </dl>
502 <a NAME="SecurityContext.isModuleBeingImported" ID="SecurityContext.isModuleBeingImported"></a>
503 <h4>SecurityContext.isModuleBeingImported</h4>
504 <b>isModuleBeingImported</b>(<i>module</i>)
505
506 <p>
507 Public method to check for the given module is currently being
508 imported.
509 </p>
510 <dl>
511
512 <dt><i>module</i> (str)</dt>
513 <dd>
514 module name to look for
515 </dd>
516 </dl>
517 <dl>
518 <dt>Return:</dt>
519 <dd>
520 flag indicating the given module was found
521 </dd>
522 </dl>
523 <dl>
524 <dt>Return Type:</dt>
525 <dd>
526 bool
527 </dd>
528 </dl>
529 <a NAME="SecurityContext.isModuleImportedExact" ID="SecurityContext.isModuleImportedExact"></a>
530 <h4>SecurityContext.isModuleImportedExact</h4>
531 <b>isModuleImportedExact</b>(<i>module</i>)
532
533 <p>
534 Public method to check if a given module has been imported; only exact
535 matches.
536 </p>
537 <dl>
538
539 <dt><i>module</i> (str)</dt>
540 <dd>
541 module name to look for
542 </dd>
543 </dl>
544 <dl>
545 <dt>Return:</dt>
546 <dd>
547 flag indicating the given module was found
548 </dd>
549 </dl>
550 <dl>
551 <dt>Return Type:</dt>
552 <dd>
553 bool
554 </dd>
555 </dl>
556 <a NAME="SecurityContext.isModuleImportedLike" ID="SecurityContext.isModuleImportedLike"></a>
557 <h4>SecurityContext.isModuleImportedLike</h4>
558 <b>isModuleImportedLike</b>(<i>module</i>)
559
560 <p>
561 Public method to check if a given module has been imported; given
562 module exists.
563 </p>
564 <dl>
565
566 <dt><i>module</i> (str)</dt>
567 <dd>
568 module name to look for
569 </dd>
570 </dl>
571 <dl>
572 <dt>Return:</dt>
573 <dd>
574 flag indicating the given module was found
575 </dd>
576 </dl>
577 <dl>
578 <dt>Return Type:</dt>
579 <dd>
580 bool
581 </dd>
582 </dl>
583 <a NAME="SecurityContext.node" ID="SecurityContext.node"></a>
584 <h4>SecurityContext.node</h4>
585 <b>node</b>(<i></i>)
586
587 <p>
588 Public method to get the raw AST node associated with the context.
589 </p>
590 <dl>
591 <dt>Return:</dt>
592 <dd>
593 raw AST node associated with the context
594 </dd>
595 </dl>
596 <dl>
597 <dt>Return Type:</dt>
598 <dd>
599 ast.AST
600 </dd>
601 </dl>
602 <a NAME="SecurityContext.statement" ID="SecurityContext.statement"></a>
603 <h4>SecurityContext.statement</h4>
604 <b>statement</b>(<i></i>)
605
606 <p>
607 Public method to get the raw AST for the current statement.
608 </p>
609 <dl>
610 <dt>Return:</dt>
611 <dd>
612 raw AST for the current statement
613 </dd>
614 </dl>
615 <dl>
616 <dt>Return Type:</dt>
617 <dd>
618 ast.AST
619 </dd>
620 </dl>
621 <a NAME="SecurityContext.stringVal" ID="SecurityContext.stringVal"></a>
622 <h4>SecurityContext.stringVal</h4>
623 <b>stringVal</b>(<i></i>)
624
625 <p>
626 Public method to get the value of a standalone string object.
627 </p>
628 <dl>
629 <dt>Return:</dt>
630 <dd>
631 value of a standalone string object
632 </dd>
633 </dl>
634 <dl>
635 <dt>Return Type:</dt>
636 <dd>
637 str
638 </dd>
639 </dl>
640 <a NAME="SecurityContext.stringValAsEscapedBytes" ID="SecurityContext.stringValAsEscapedBytes"></a>
641 <h4>SecurityContext.stringValAsEscapedBytes</h4>
642 <b>stringValAsEscapedBytes</b>(<i></i>)
643
644 <p>
645 Public method to get the escaped value of the object.
646 </p>
647 <p>
648 Turn the value of a string or bytes object into a byte sequence with
649 unknown, control, and \\ characters escaped.
650 </p>
651 <p>
652 This function should be used when looking for a known sequence in a
653 potentially badly encoded string in the code.
654 </p>
655 <dl>
656 <dt>Return:</dt>
657 <dd>
658 sequence of printable ascii bytes representing original string
659 </dd>
660 </dl>
661 <dl>
662 <dt>Return Type:</dt>
663 <dd>
664 str
665 </dd>
666 </dl>
667 <div align="right"><a href="#top">Up</a></div>
668 <hr />
669 </body></html>

eric ide

mercurial