32 |
32 |
33 |
33 |
34 def checkNoCertificateValidation(reportError, context, config): |
34 def checkNoCertificateValidation(reportError, context, config): |
35 """ |
35 """ |
36 Function to check for switched off certificate validation. |
36 Function to check for switched off certificate validation. |
37 |
37 |
38 @param reportError function to be used to report errors |
38 @param reportError function to be used to report errors |
39 @type func |
39 @type func |
40 @param context security context object |
40 @param context security context object |
41 @type SecurityContext |
41 @type SecurityContext |
42 @param config dictionary with configuration data |
42 @param config dictionary with configuration data |
43 @type dict |
43 @type dict |
44 """ |
44 """ |
45 http_verbs = ('get', 'options', 'head', 'post', 'put', 'patch', 'delete') |
45 http_verbs = ("get", "options", "head", "post", "put", "patch", "delete") |
46 if ( |
46 if ( |
47 'requests' in context.callFunctionNameQual and |
47 "requests" in context.callFunctionNameQual |
48 context.callFunctionName in http_verbs and |
48 and context.callFunctionName in http_verbs |
49 context.checkCallArgValue('verify', 'False') |
49 and context.checkCallArgValue("verify", "False") |
50 ): |
50 ): |
51 reportError( |
51 reportError( |
52 context.getLinenoForCallArg('verify') - 1, |
52 context.getLinenoForCallArg("verify") - 1, |
53 context.getOffsetForCallArg('verify'), |
53 context.getOffsetForCallArg("verify"), |
54 "S501", |
54 "S501", |
55 "H", |
55 "H", |
56 "H" |
56 "H", |
57 ) |
57 ) |