You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public with sharing class TestClassApex {
public static void exampleMethod() {
List<CBConfig__c> configs = [SELECT Id FROM CBConfig__c WITH SECURITY_ENFORCED];
if (Schema.SObjectType.CBConfig__c.isDeletable()) {
delete configs;
}
}
}
I'm running the check through:
sf scanner run --format csv --outfile CodeAnalyzerGeneral.csv --target ./ --category Security
And getting ApexCRUDViolation.
I'm using @salesforce/sfdx-scanner@latest-beta version 4.1. I also tried with the version 3.23.
The text was updated successfully, but these errors were encountered:
Thanks for raising @illarionova! That specific rule likely needs to be updated to match current best practices - we are aware there are some gaps between how rules are setup and the latest best practice.
These days we recommend using User Mode for queries and database operations as per our docs
We are currently working on overhauling our core Code Analyzer architecture to make it easier for us to help you understand which rules align with the latest best practice, which will likely lead to us contributing updates to rules in engines such as PMD later in the year / early next year.
I am trying to check for object-level delete permission on a custom object before performing a DML delete operation on it.
The check is performed as it is shown in documentation here: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_perms_enforcing.htm.
I'm running the check through:
sf scanner run --format csv --outfile CodeAnalyzerGeneral.csv --target ./ --category Security
And getting ApexCRUDViolation.
I'm using @salesforce/sfdx-scanner@latest-beta version 4.1. I also tried with the version 3.23.
The text was updated successfully, but these errors were encountered: