1

When I scanned my app yesterday, and it raised a bunch of CRUD Delete security issue. So, I added isDeletable() check to all the delete query, and scanned it again. Still, it showed the same security issue on the same queries. So, i googled a little bit and some of the results suggested to put isAccessible() check along with isDeletable(). So I did that and scanned. Still, scan raised the CRUD Delete issue. This is my final code:

if (Schema.sObjectType.PurchasedProduct__c.isAccessible() && Schema.sObjectType.PurchasedProduct__c.isDeletable()) {
     delete pProduct;
}

What is wrong with this code? Is there anything else I have to do remove the CRUD Delete security issue?

I am using Checkmarx Scan.

7
  • Are you using a Checkmarx scan? Are you sure you deployed the updated code to the org you are scanning?
    – Phil W
    Jun 1, 2020 at 9:49
  • yes. i verified it. i am deploying the updated code. Jun 1, 2020 at 9:50
  • And you are using Checkmarx? How are you running the scan?
    – Phil W
    Jun 1, 2020 at 9:51
  • (It would be a good idea to add these details to your question, by editing it)
    – Phil W
    Jun 1, 2020 at 9:52
  • I am using Checkmarx scan. security.secure.force.com/security/tools/forcecom/scanner Jun 1, 2020 at 9:52

1 Answer 1

1

Along with isAccessible () Try the below syntax

List myList = [Select Id,Name from myObject__c]; if(myObject__c.sObjectType.getDescribe().isDeletable()){ delete myList; }

1
  • thanks. it worked Jun 2, 2020 at 3:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .