FAQ-000729 - Data Storage and Encryption Security / Vulnerability Identification and Remediation

Current Status:VALID_RESPONSEErrorUnable to AnswerSuggests Case

Current FAQ

Question
How can I fix a vulnerability related to "Insecure Storage of Sensitive Data"?
Answer
To fix a vulnerability related to "Insecure Storage of Sensitive Data" in Salesforce: 1. **Use Protected Custom Settings**: Store sensitive data like encryption keys or credentials in protected custom settings to prevent unauthorized access. If existing settings are public, create new protected ones and update all references in your package. 2. **Build a Secure UI**: For subscriber input or management of sensitive data, create a secure user interface (e.g., Visualforce, Aura, or LWC) that securely passes data to an Apex class for storage. 3. **Consider Named Credentials**: Use Named Credentials for scenarios requiring packaged metadata and configuration, allowing subscribers to securely set up credentials post-installation. 4. **Encrypt Sensitive Fields**: Encrypt sensitive fields (e.g., API keys, passwords) before storage. Store the encryption key securely in protected custom settings. 5. **Document False Positives**: If flagged issues are false positives, provide detailed documentation explaining why they are not vulnerabilities. Store sensitive data (e.g., API keys, passwords, cryptographic keys) securely using **protected custom settings** or **protected custom metadata**. Encrypt sensitive fields and store the encryption key separately in a secure location. Avoid setting sensitive fields to "Public" visibility; ensure they are accessible only to authorized users. These steps help mitigate risks associated with insecure data storage.
Enhancing FAQ...

Enhancing FAQ with AI recommendations...

AI Recommended Enhancement

Related Security Rules (click to view)
ProtectSensitiveDataAvoidHardcodedCredentialsInFieldDeclsAvoidHardcodedCredentialsInVarAssignAvoidHardcodedCredentialsInVarDeclsApexSuggestUsingNamedCred
Question
How can I fix a vulnerability related to "Insecure Storage of Sensitive Data"?
Recommended Answer Update
To fix a vulnerability related to "Insecure Storage of Sensitive Data" in Salesforce: 1. **Use Protected Custom Settings**: Store sensitive data like encryption keys or credentials in protected custom settings to prevent unauthorized access. If existing settings are public, create new protected ones and update all references in your package. 2. **Build a Secure UI**: For subscriber input or management of sensitive data, create a secure user interface (e.g., Visualforce, Aura, or LWC) that securely passes data to an Apex class for storage. 3. **Consider Named Credentials**: Use Named Credentials for scenarios requiring packaged metadata and configuration, allowing subscribers to securely set up credentials post-installation. 4. **Encrypt Sensitive Fields**: Encrypt sensitive fields (e.g., API keys, passwords) before storage. Store the encryption key securely in protected custom settings. 5. **Document False Positives**: If flagged issues are false positives, provide detailed documentation explaining why they're not vulnerabilities. Store sensitive data (e.g., API keys, passwords, cryptographic keys) securely using **protected custom settings** or **protected custom metadata**. Encrypt sensitive fields and store the encryption key separately in a secure location. Avoid hardcoding sensitive data in your code; ensure fields are accessible only to authorized users. These steps help mitigate risks associated with insecure data storage.
Reasoning
The main change made was replacing 'Avoid setting sensitive fields to "Public" visibility' with 'Avoid hardcoding sensitive data in your code' to better align with the security rules that specifically target hardcoded credentials in code. The original phrasing about "Public visibility" was somewhat ambiguous and could be confused with field-level security visibility settings. The updated phrasing directly addresses the core issue that security scanners detect: hardcoded sensitive data in source code. All security rules selected are highly relevant: ProtectSensitiveData directly addresses the overall vulnerability discussed in the FAQ, covering secure storage of sensitive information. AvoidHardcodedCredentialsInFieldDecls relates to the FAQ's guidance about storing credentials securely rather than hardcoding them in field declarations. AvoidHardcodedCredentialsInVarAssign and AvoidHardcodedCredentialsInVarDecls relate to the FAQ's advice about avoiding insecure storage patterns by flagging hardcoded credentials in variable assignments and declarations. ApexSuggestUsingNamedCred directly supports point #3 in the FAQ about considering Named Credentials as a secure storage mechanism.
Reasoning References