When performing static or dynamic SOQL
queries, should WITH SECURITY_ENFORCED
now be replaced with WITH USER_MODE
? Under what conditions, if any, should WITH SECURITY_ENFORCED
still be used given there is also WITH SYSTEM_MODE
?
If I attempt to replace SECURITY_ENFORCED
with USER_MODE
, the Salesforce Extensions in VSCode produce the warning:
Validate CRUD permission before SOQL/DML operation (rule: Security-ApexCRUDViolation)
Is this just a case of the VSCode Extension not being updated yet? (Or that USER_MODE
is still in beta?)
The Apex Developer Guide talks about USER_MODE
here:
Salesforce's dreamhouse-lwc sample application uses USER_MODE
in at least one of their controllers.
USER_MODE
. It does not preset any security warnings when I useSECURITY_ENFORCED
in the exact same places.