FAQ-001509 - Proactive Security Architecture Review / Architecture and Design Review

Current Status:VALID_RESPONSEErrorUnable to AnswerSuggests Case

Current FAQ

Question
What are the key architectural security principles I should follow when building a new application?
Answer
Here are the key architectural security principles to follow when building a new application: 1. **Encryption and Cryptography**: Use strong encryption for data at rest and in transit. Safeguard encryption keys and avoid custom cryptography - rely on supported APIs. 2. **Authentication and Authorization**: Authenticate and authorize requests before processing privileged actions, especially for confidential objects like payment instruments. Implement proper access controls. 3. **Principle of Least Privilege**: Assign users only the permissions they need and document these for customers. 4. **Sensitive Data Handling**: Protect sensitive data (payment info, personal data, tokens), redact it in logs, and disclose storage locations/providers. 5. **Secure Coding Practices**: Validate and sanitize user inputs, avoid dynamically loading third-party scripts, and prevent code injection or CSRF attacks. 6. **Logging and Debugging**: Avoid logging sensitive information like API credentials or passwords in production environments. 7. **Third-Party Integrations**: Use OAuth for integrations, ensure secure remote site settings, and enforce HTTPS with proper SSL configurations. 8. **Security Program and Policies**: Establish a corporate security policy, designate a security expert, and integrate security throughout development. Conduct third-party audits and share certifications. 9. **Architecture and Dependencies**: Create diagrams showing data flows and security controls, and maintain an inventory of third-party libraries with version tracking. 10. **Compliance and Documentation**: Follow industry security standards and document activities like vulnerability management and breach response procedures. 11. **Regular Testing**: Use automated security scanning tools and manual testing to identify vulnerabilities throughout development. 12. **Follow-the-Data Approach**: Ensure all components and endpoints handling data are secure, including external endpoints with proper permissions for testing. These principles will help ensure a secure foundation for your application and alignment with security best practices before development is complete.
Enhancing FAQ...

Enhancing FAQ with AI recommendations...

AI Recommended Enhancement

Related Security Rules (click to view)
ApexBadCryptoApexCRUDViolationApexCSRFApexSOQLInjectionApexXSSFromEscapeFalseApexXSSFromURLParamApexSharingViolationsApexInsecureEndpointApexSuggestUsingNamedCredAvoidHardcodedCredentialsInFieldDeclsAvoidHardcodedCredentialsInHttpHeaderAvoidHardcodedCredentialsInVarDeclsAvoidInsecureHttpRemoteSiteSettingAvoidDisableProtocolSecurityRemoteSiteSettingUseHttpsCallbackUrlConnectedAppVfCsrfVfUnescapeElLibraryWithKnownCriticalSeverityVulnerabilityLibraryWithKnownHighSeverityVulnerability
Question
What are the key architectural security principles I should follow when building a new application?
Recommended Answer Update
Here are the key architectural security principles to follow when building a new application: 1. **Encryption and Cryptography**: Use strong encryption for data at rest and in transit. Safeguard encryption keys and avoid custom cryptography - rely on platform-supported APIs. 2. **Authentication and Authorization**: Authenticate and authorize requests before processing privileged actions, especially for confidential objects like payment instruments. Implement proper access controls and use sharing keywords appropriately. 3. **Principle of Least Privilege**: Assign users only the permissions they need and document these requirements for customers. 4. **Sensitive Data Handling**: Protect sensitive data (payment info, personal data, tokens), redact it in logs, and disclose storage locations and third-party providers to customers. 5. **Secure Coding Practices**: Validate and sanitize user inputs, avoid dynamically loading third-party scripts, and prevent code injection, SOQL injection, XSS, and CSRF attacks. 6. **Logging and Debugging**: Avoid logging sensitive information like API credentials or passwords in production environments. 7. **Third-Party Integrations**: Use OAuth for integrations with Named Credentials where possible, ensure secure remote site settings with HTTPS, and enforce proper SSL configurations. 8. **Security Program and Policies**: Establish a corporate security policy, designate a security expert, and integrate security throughout development. Conduct third-party audits and share certifications. 9. **Architecture and Dependencies**: Create diagrams showing data flows and security controls, and maintain an inventory of third-party libraries with version tracking to avoid known vulnerabilities. 10. **Compliance and Documentation**: Follow industry security standards and document activities like vulnerability management and breach response procedures. 11. **Regular Testing**: Use automated security scanning tools and manual testing to identify vulnerabilities throughout development. 12. **Follow-the-Data Approach**: Ensure all components and endpoints handling data are secure, including external endpoints with proper permissions for testing. These principles will help ensure a secure foundation for your application and alignment with security best practices before development is complete.
Reasoning
Made several minor refinements to improve clarity and specificity while preserving all original points: (1) Changed 'supported APIs' to 'platform-supported APIs' for clarity about Salesforce platform capabilities, (2) Added 'and use sharing keywords appropriately' to the authentication section to acknowledge proper sharing enforcement, (3) Added 'requirements' to clarify what should be documented for customers, (4) Added 'and third-party providers to customers' to be more specific about disclosure obligations, (5) Expanded 'code injection or CSRF attacks' to 'code injection, SOQL injection, XSS, and CSRF attacks' to be more comprehensive about common attack vectors, (6) Added 'with Named Credentials where possible' to OAuth guidance for better security practice, (7) Added 'to avoid known vulnerabilities' to dependency management to clarify the security purpose. All security rules were selected based on their direct relationship to the architectural principles discussed: ApexBadCrypto relates to the encryption/cryptography principle, ApexCRUDViolation and ApexSharingViolations relate to authentication/authorization and least privilege principles, ApexCSRF, ApexSOQLInjection, ApexXSSFromEscapeFalse, ApexXSSFromURLParam, and VfCsrf/VfUnescapeEl all relate to the secure coding practices principle covering various attack vectors, ApexInsecureEndpoint relates to endpoint security, ApexSuggestUsingNamedCred relates to the third-party integrations principle, hardcoded credentials rules relate to sensitive data handling, remote site security rules relate to third-party integrations, and vulnerability detection rules relate to the dependency management principle.
Reasoning References
Recommended Related Articles