Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Salesforce
  3. Force.com ESAPI

Force.com ESAPI

BSD-3-ClauseApex1.61

A security library for Apex on Force.com that provides input validation, output encoding, and access control enforcement.

GitHubGitHub
129 stars38 forks0 contributors

What is Force.com ESAPI?

Force.com ESAPI is an open-source Enterprise Security API for the Apex programming language on the Salesforce Force.com platform. It provides developers with tools to validate input, encode output, and enforce access controls, helping to prevent common security vulnerabilities like injection attacks and unauthorized data access in custom Salesforce applications.

Target Audience

Salesforce developers and administrators building custom Apex applications on the Force.com platform who need to implement robust security measures and comply with Salesforce security best practices.

Value Proposition

Developers choose Force.com ESAPI because it seamlessly integrates security enforcement into Apex code, offering a standardized way to handle validation, encoding, and access control that aligns with Salesforce's security models, reducing manual security implementation errors.

Overview

Enterprise Security API for the Apex language on the Force.com platform.

Use Cases

Best For

  • Validating untrusted user input in Apex controllers
  • Encoding output for safe display in Visualforce pages
  • Enforcing CRUD and FLS permissions in system context Apex code
  • Implementing sharing rule enforcement in custom Apex logic
  • Preventing injection attacks in Salesforce custom applications
  • Handling security exceptions with detailed error messages in Apex

Not Ideal For

  • Teams building applications primarily with Salesforce Lightning Web Components, as ESAPI is designed for Apex and Visualforce security, not modern client-side frameworks.
  • Projects that rely entirely on Salesforce's declarative tools like Flows or Process Builders, with minimal or no custom Apex code requiring security enforcement.
  • Organizations using third-party security scanning tools integrated into CI/CD pipelines, as ESAPI operates at the code level within Apex rather than providing external audit capabilities.

Pros & Cons

Pros

Comprehensive Input Validation

Provides both exception-based and boolean methods for validating untrusted input like credit card numbers directly in Apex, as shown in the README's getValidCreditCard and isValidCreditCard examples, preventing injection attacks.

Integrated Output Encoding

Encodes output for safe display in Visualforce pages using functions like SFDC_HTMLENCODE, equivalent to built-in Visualforce encoding but within Apex classes, ensuring consistent security in business logic.

User Context Access Control

Enforces Salesforce's CRUD, FLS, and Sharing models in Apex by allowing execution in user context, with methods like updateAsUser, preventing security bypasses in system mode as detailed in the access control example.

Detailed Exception Handling

Offers specific security exception messages via SFDCAccessControlException, with methods like getExceptionType() and getExceptionReason(), improving debugging and compliance reporting.

Cons

Manual Deployment Process

Requires downloading and uploading classes to the Force.com Org or using a one-click deployment link, which is cumbersome compared to modern package management or seamless Salesforce DX integrations.

Limited to Legacy Technologies

Primarily supports Apex and Visualforce, with no built-in integration for newer Salesforce frameworks like Lightning Web Components, reducing its relevance for contemporary UI development.

Sparse Documentation

The README directs users to a separate doc folder for detailed documentation, which may not be comprehensive or up-to-date, increasing the learning curve and reliance on community support.

Frequently Asked Questions

Quick Stats

Stars129
Forks38
Contributors0
Open Issues1
Last commit1 month ago
CreatedSince 2015

Tags

#secure-coding#salesforce#apex#input-validation#force-com#security-library#visualforce#access-control

Built With

A
Apex

Included in

Salesforce782
Auto-fetched 18 hours ago

Related Projects

Apex CommonsApex Commons

Common Apex Library supporting Apex Enterprise Patterns and much more!

Stars1,009
Forks571
Last commit6 days ago
Apex Metadata APIApex Metadata API

Apex Wrapper for the Salesforce Metadata API

Stars720
Forks987
Last commit11 months ago
Apex mocksApex mocks

An Apex mocking framework for true unit testing in Salesforce, with Stub API support

Stars459
Forks235
Last commit1 day ago
Force DIForce DI

Generic DI library with support for Apex, Triggers, Visualforce and Lightning

Stars239
Forks101
Last commit18 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub