Secure Your B2C Commerce Solution
Encryption, Cryptography, and Secret Storage
Protect data at rest using strong encryption schemes, and protect the encryption keys.
Authentication and Authorization
Before processing requests that carry privileged actions, authenticate and authorize the requests. Also enforce authentication and authorization when reading or writing confidential objects such as Order, Customer, and PaymentInstrument.
Open Commerce API (OCAPI) and Salesforce Commerce API (SCAPI) Settings
Follow the principle of least privilege for OCAPI and SCAPI permissions. Provide users with the minimum set of permissions required to perform a task. Document the permissions, and share them with your customers.
See OCAPI Settings and Authorization for SCAPI.
Sensitive Data Storage and Logging
Sensitive data is any information that must be protected against unauthorized access. Different regulations classify information as sensitive data and can include payment instruments, protected health information, personally identifiable information, access tokens, and encryption keys. Document and disclose to customers a list of sensitive data stored or processed by your solution. Redact sensitive data in B2C Commerce log files.
Cryptography
Use supported cryptography APIs such as dw.crypto. Don’t implement custom cryptography.
Client-Side Scripts
Include and serve all client-side scripts statically from the B2C Commerce cartridge. Avoid dynamically loading third-party scripts from content delivery networks (CDNs) or other third parties.
Code Injection
Don’t interpret any input data as script. Statically include all source code.
User-Input Validation
Ensure that user input is exactly the kind of data that your solution expects. Validate all user input before processing.
See Data Validation.
User Input
Escape all user-provided content before rendering it in any context including HTML and JavaScript.
Cross-Site Request Forgery (CSRF)
Include CSRF protection in all state-changing controllers.
Open Redirects
Open redirects are used in phishing attacks to redirect users to any URL. Never redirect users based on untrusted data. Follow the practices in Open Redirect Attacks.
Content Security Policy
Document and share your Content Security Policy with customers when applicable.
Patches and Upgrades
To simplify installation of patches and upgrades, direct customers to use separate cartridges for customizations whenever possible.
Environments
Follow the B2C Commerce security guidelines as you set up, administer, and develop your Salesforce B2C Commerce environments.