dynamo-injections
Ast Rule: function call
dynamo-injections
function visit(node, filename, code) {
if (node.functionName && node.functionName.value === "scan") {
// make sure we use boto3
if (!useModule(node.context.imports, "boto3")) {
return;
}
// get the client variable
const clientVariable = findVariableFromFunctionCall(node.context.assignments, "boto3", "client");
// check if the value contains a user-controlled data
if (node.arguments && node.arguments.values) {
const filterExpressions = node.arguments.values.filter(v => v.name && v.name.value === "FilterExpression");
if (filterExpressions.length > 0) {
const fe = filterExpressions[0];
if (fe.value.value.includes("+")) {
const error = buildError(fe.start.line, fe.start.col,
fe.end.line, fe.end.col,
"String concanetation that may lead to SQL injection", "CRITICAL", "SECURITY");
addError(error);
}
}
}
}
}
failure.py
Expected test result: has error
no-boto3-use.py
Expected test result: no error