What's It Called: Inner Class Without Sharing?

When this pattern is done unintentionally, it's a "privilege escalation bug," which is a major security concern. This design pattern will at least raise red flags with the security review team if this pattern is used in a package, and will also be flagged by the Cloud Security scanner. It's usually better to configure the system to allow users to do things with normal permissions.

However, sometimes you need to do this, to allow things to be done that the user can't normally do. For example, maybe you need to allow users to merge contacts, but not outright delete contacts. By removing the Delete Contact permission, you can still give them controlled access to merge contacts by getting around the security model. When done intentionally, I'd want to call this an elevated privileges pattern, which suggests that you're intentionally elevating their privileges just for a single transaction.


I believe the term you're looking for is Trampoline because it allows a developer to "Bounce" up into a higher security context. Trampolines should be written very carefully and validate their parameters and be well documented in place as to the why such behavior is needed.

It is important to note that a trampoline will only ever bypass sharing and not field level security. This is because Field Level security is already not enforced in apex.