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

branch
eric7
changeset 9325
8157eb19aba5
parent 9221
bf71ee032bb4
child 9653
e67609152c5e
equal deleted inserted replaced
9324:7f7f3e47b238 9325:8157eb19aba5
31 } 31 }
32 32
33 33
34 def checkYamlLoad(reportError, context, config): 34 def checkYamlLoad(reportError, context, config):
35 """ 35 """
36 Function to check for the use of of yaml load functions. 36 Function to check for the use of yaml load functions.
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
53 [ 53 [
54 "yaml" in qualnameList, 54 "yaml" in qualnameList,
55 func == "load", 55 func == "load",
56 not context.checkCallArgValue("Loader", "SafeLoader"), 56 not context.checkCallArgValue("Loader", "SafeLoader"),
57 not context.checkCallArgValue("Loader", "CSafeLoader"), 57 not context.checkCallArgValue("Loader", "CSafeLoader"),
58 context.getCallArgAtPosition(1) != "SafeLoader",
59 context.getCallArgAtPosition(1) != "CSafeLoader",
58 ] 60 ]
59 ): 61 ):
60 reportError(context.node.lineno - 1, context.node.col_offset, "S506", "M", "H") 62 reportError(context.node.lineno - 1, context.node.col_offset, "S506", "M", "H")

eric ide

mercurial