Here are the key security and encryption guidelines for applications exposing data in public sites or communities:
1. **Data Encryption**: Use strong encryption (e.g., AES-128 or higher) to protect sensitive data at rest. Store encryption keys securely and separately from the encrypted data.
2. **Authentication and Authorization**: Enforce strict authentication and authorization for privileged actions and access to confidential objects. Follow the principle of least privilege.
3. **Secure Data Storage**: Avoid storing sensitive data in public custom settings or metadata. Use protected custom settings or metadata fields, and encrypt sensitive data stored in object fields.
4. **Logging Practices**: Do not log sensitive data like passwords, API tokens, or encryption keys in production. Redact or omit such data from logs.
5. **Cross-Site Scripting (XSS) Protection**: Sanitize user inputs and outputs to prevent XSS attacks. Use proper encoding in VisualForce and Lightning components.
6. **Secure Entry Points**: Secure all application entry points (e.g., VisualForce controllers, AuraEnabled methods) by enforcing sharing rules.
7. **Avoid Insecure Practices**: Do not dynamically load third-party scripts or stylesheets. Include them as static resources in the application package.
8. **Compliance with Standards**: Follow enterprise security standards and AppExchange security review guidelines to ensure secure coding practices.
For more details, you can refer to the [AppExchange Security Review Guidelines](/).