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.

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

Along with isAccessible () Try the below syntax

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.