+ Start a Discussion
Amit Singh 1Amit Singh 1 

how to remove crud delete security issue in Salesforce Checkmarx?

Hi Folks.

Need urgent help. I am stucked into Salesforce Security Checkmarx isue I am getting CRUD Delete error while I have applied all the check into Delete operation. Still getting same Error.
I have a list of Dynamic sObject it can be any sObject. Below is Screenshot of My code and code as.

Please help any help will be greatly appriciated.
public static boolean isSafeObjectDel(List<sobject> delId) {
        boolean result=false;
        Map <String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
        for(Sobject del  : delId){
            Id dId = del.id;
            String objName = dId.getSObjectType().getDescribe().getName();
            SObjectType myObj = Schema.getGlobalDescribe().get(objName);
             if (myObj.getDescribe().isDeletable()) {
                result = true; 
            }else{
               return false;
            }
        }
       return result;
       
    }
User-added image


Thanks,
Amit
Best Answer chosen by Amit Singh 1
Amit Singh 1Amit Singh 1
I am running as Admin. I have all the permission but I am getting this error while submitting my code for checkmarx.

All Answers

NagendraNagendra (Salesforce Developers) 
Hi Amit,

May I request you please confirm if you have the delete permission on the object you are operating?

If you are getting the above error being logged in as a system administrator may I suggest you please check with following steps from the below link which might help? Please let us know if this helps.

Thanks,
Nagendra


 
Amit Singh 1Amit Singh 1
I am running as Admin. I have all the permission but I am getting this error while submitting my code for checkmarx.
This was selected as the best answer