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") |