use of net.sourceforge.pmd.lang.apex.ast.ASTVariableDeclaration in project pmd by pmd.
the class ApexBadCryptoRule method visit.
@Override
public Object visit(ASTUserClass node, Object data) {
if (Helper.isTestMethodOrClass(node)) {
return data;
}
List<ASTFieldDeclaration> fieldDecl = node.findDescendantsOfType(ASTFieldDeclaration.class);
for (ASTFieldDeclaration var : fieldDecl) {
findSafeVariables(var);
}
List<ASTVariableDeclaration> variableDecl = node.findDescendantsOfType(ASTVariableDeclaration.class);
for (ASTVariableDeclaration var : variableDecl) {
findSafeVariables(var);
}
List<ASTMethodCallExpression> methodCalls = node.findDescendantsOfType(ASTMethodCallExpression.class);
for (ASTMethodCallExpression methodCall : methodCalls) {
if (Helper.isMethodName(methodCall, CRYPTO, ENCRYPT) || Helper.isMethodName(methodCall, CRYPTO, DECRYPT) || Helper.isMethodName(methodCall, CRYPTO, ENCRYPT_WITH_MANAGED_IV) || Helper.isMethodName(methodCall, CRYPTO, DECRYPT_WITH_MANAGED_IV)) {
validateStaticIVorKey(methodCall, data);
}
}
potentiallyStaticBlob.clear();
return data;
}
Aggregations