FAQ-000509 - Custom Settings and Configuration Security / Protected Custom Settings vs Other Storage Methods

Current Status:VALID_RESPONSEErrorUnable to AnswerSuggests Case

Current FAQ

Question
How do I choose between Platform Cache, encrypted custom objects, and protected custom settings?
Answer
To choose between Platform Cache, encrypted custom objects, and protected custom settings for sensitive data, consider these factors: 1. **Platform Cache**: - Best for temporary storage of frequently accessed data to boost performance. - Not suitable for sensitive or persistent data since it's not encrypted and has a limited lifespan. - Useful for improving performance by reducing repeated computations or data retrievals. 2. **Encrypted Custom Objects**: - Use when sensitive data needs secure, persistent storage within the application. - Ideal for storing sensitive data that needs encryption. - Ensure encryption keys are stored separately (e.g., in protected custom settings or metadata) for added security. - Allows for storing secrets with encryption, supports larger data sizes, and offers flexibility. - Performance may be impacted due to encryption and decryption processes. 3. **Protected Custom Settings**: - Ideal for securely storing and managing sensitive data like credentials or configuration data. - Perfect for sensitive configuration data or secrets that need protection from unauthorized access. - Suitable for managed packages where data should not be accessible to subscribers or external packages. - Note the 255-character limit for string fields. - Designed for securely storing sensitive data with built-in encryption and restricted access. The choice depends on your specific use case, such as whether the data needs to persist, the level of security required, how the data will be accessed, performance needs, data sensitivity, and access requirements.
Enhancing FAQ...

Enhancing FAQ with AI recommendations...

AI Recommended Enhancement

Related Security Rules (click to view)
ApexSuggestUsingNamedCredAvoidHardcodedCredentialsInFieldDeclsAvoidHardcodedCredentialsInVarDeclsAvoidHardcodedCredentialsInVarAssignProtectSensitiveData
Question
How do I choose between Platform Cache, encrypted custom objects, and protected custom settings?
Recommended Answer Update
To choose between Platform Cache, encrypted custom objects, and protected custom settings for sensitive data, consider these factors: 1. **Platform Cache**: - Best for temporary storage of frequently accessed data to boost performance. - Not suitable for sensitive or persistent data since it's not encrypted and has a limited lifespan. - Useful for improving performance by reducing repeated computations or data retrievals. 2. **Encrypted Custom Objects**: - Use when sensitive data needs secure, persistent storage within the application. - Ideal for storing sensitive data that requires encryption. - Ensure encryption keys are stored separately (e.g., in protected custom settings or Named Credentials) for added security. - Allows for storing secrets with encryption, supports larger data sizes, and offers flexibility. - Performance may be impacted due to encryption and decryption processes. 3. **Protected Custom Settings**: - Ideal for securely storing and managing sensitive data like credentials or configuration data. - Perfect for sensitive configuration data or secrets that need protection from unauthorized access. - Suitable for managed packages where data should not be accessible to subscribers or external packages. - Note the 255-character limit for string fields. - Designed for securely storing sensitive data with built-in encryption and restricted access. The choice depends on your specific use case, such as whether the data needs to persist, the level of security required, how the data will be accessed, performance needs, data sensitivity, and access requirements.
Reasoning
The main improvement needed is updating the recommendation for storing encryption keys. The original answer suggests storing encryption keys 'in protected custom settings or metadata' which could be misleading since hardcoded credentials in metadata or field declarations violate security best practices. The updated answer recommends 'protected custom settings or Named Credentials' instead, aligning with the ApexSuggestUsingNamedCred rule which promotes using Named Credentials for secure credential storage. This change removes the potentially unsafe 'metadata' reference while keeping protected custom settings as a valid option. All other content remains unchanged as it accurately describes the three storage options and their appropriate use cases. Regarding related security rules: - ApexSuggestUsingNamedCred: This FAQ discusses storing credentials and sensitive configuration data, and Named Credentials are the recommended secure approach for credential management mentioned in this rule. - AvoidHardcodedCredentialsInFieldDecls: The FAQ discusses storing sensitive data and credentials in custom objects and settings, which relates to avoiding hardcoded credentials in field declarations. - AvoidHardcodedCredentialsInVarDecls: The FAQ covers secure storage of credentials and sensitive data, relating to avoiding hardcoded credentials in variable declarations. - AvoidHardcodedCredentialsInVarAssign: The FAQ addresses secure credential storage practices, which connects to avoiding hardcoded credentials in variable assignments. - ProtectSensitiveData: The entire FAQ is about choosing appropriate methods for protecting sensitive data, which directly aligns with this rule's purpose of protecting sensitive information.
Reasoning References