35 list of codes |
35 list of codes |
36 @rtype dict |
36 @rtype dict |
37 """ |
37 """ |
38 return { |
38 return { |
39 "Call": [ |
39 "Call": [ |
40 (checkSubprocessPopenWithShell, ("S602",)), |
40 (checkSubprocessPopenWithShell, ("S-602",)), |
41 (checkSubprocessPopenWithoutShell, ("S603",)), |
41 (checkSubprocessPopenWithoutShell, ("S-603",)), |
42 (checkOtherFunctionWithShell, ("S604",)), |
42 (checkOtherFunctionWithShell, ("S-604",)), |
43 (checkStartProcessWithShell, ("S605",)), |
43 (checkStartProcessWithShell, ("S-605",)), |
44 (checkStartProcessWithNoShell, ("S606",)), |
44 (checkStartProcessWithNoShell, ("S-606",)), |
45 (checkStartProcessWithPartialPath, ("S607",)), |
45 (checkStartProcessWithPartialPath, ("S-607",)), |
46 ], |
46 ], |
47 } |
47 } |
48 |
48 |
49 |
49 |
50 def _evaluateShellCall(context): |
50 def _evaluateShellCall(context): |
120 sev = _evaluateShellCall(context) |
120 sev = _evaluateShellCall(context) |
121 if sev == "L": |
121 if sev == "L": |
122 reportError( |
122 reportError( |
123 context.getLinenoForCallArg("shell") - 1, |
123 context.getLinenoForCallArg("shell") - 1, |
124 context.getOffsetForCallArg("shell"), |
124 context.getOffsetForCallArg("shell"), |
125 "S602.L", |
125 "S-602.L", |
126 sev, |
126 sev, |
127 "H", |
127 "H", |
128 ) |
128 ) |
129 else: |
129 else: |
130 reportError( |
130 reportError( |
131 context.getLinenoForCallArg("shell") - 1, |
131 context.getLinenoForCallArg("shell") - 1, |
132 context.getOffsetForCallArg("shell"), |
132 context.getOffsetForCallArg("shell"), |
133 "S602.H", |
133 "S-602.H", |
134 sev, |
134 sev, |
135 "H", |
135 "H", |
136 ) |
136 ) |
137 |
137 |
138 |
138 |
211 sev = _evaluateShellCall(context) |
211 sev = _evaluateShellCall(context) |
212 if sev == "L": |
212 if sev == "L": |
213 reportError( |
213 reportError( |
214 context.node.lineno - 1, |
214 context.node.lineno - 1, |
215 context.node.col_offset, |
215 context.node.col_offset, |
216 "S605.L", |
216 "S-605.L", |
217 sev, |
217 sev, |
218 "H", |
218 "H", |
219 ) |
219 ) |
220 else: |
220 else: |
221 reportError( |
221 reportError( |
222 context.node.lineno - 1, |
222 context.node.lineno - 1, |
223 context.node.col_offset, |
223 context.node.col_offset, |
224 "S605.H", |
224 "S-605.H", |
225 sev, |
225 sev, |
226 "H", |
226 "H", |
227 ) |
227 ) |
228 |
228 |
229 |
229 |
291 # make sure the param is a string literal and not a var name |
291 # make sure the param is a string literal and not a var name |
292 if AstUtilities.isString(node) and not fullPathMatchRe.match(node.value): |
292 if AstUtilities.isString(node) and not fullPathMatchRe.match(node.value): |
293 reportError( |
293 reportError( |
294 context.node.lineno - 1, |
294 context.node.lineno - 1, |
295 context.node.col_offset, |
295 context.node.col_offset, |
296 "S607", |
296 "S-607", |
297 "L", |
297 "L", |
298 "H", |
298 "H", |
299 ) |
299 ) |