+ Start a Discussion
Anuj Joshi 42Anuj Joshi 42 

checkmarx with sharing issue

Hi All,

I have some some controllers in my org which are declared as without sharing and virtual. When I run the checkmarx report I get the Sharng issue like this
All entry points to an app (Global or Controller classes) must use the 'with sharing' keyword. Classes without this keyword run without sharing if they are entry points to your code, or with the sharing policy of the caller. Do not omit the sharing declaration as this hides critical security information in side-effects that can change when code is refactored. Only declare classes as 'without sharing' if they are not entry points to your app and if they only modify objects whose security is managed by your code (such as wizard state, or fields in a site). It is a common misconception to believe that batch apex or async apex must run with the global keyword. This is not true, the only classes that must be global are those that expose webservices or are intended to be used by extension packages. All async apex should run as public in order to avoid creating privileged entry points to your app.

I need solution to fix this issue.

Thanks,
Anuj