FAQ-000721 - Data Storage and Encryption Security / Secure Storage Best Practices

Current Status:VALID_RESPONSEErrorUnable to AnswerSuggests Case

Current FAQ

Question
What is the secure way to store and mask credentials within a custom object?
Answer
To securely store and mask credentials within a custom object: Use AES symmetric encryption/decryption in Apex to encrypt the credentials, store the encryption key securely in Protected Custom Metadata, share the decrypted value only with authorized callers, and enforce proper CRUD/FLS and sharing checks in the Apex code to restrict access to the data. These steps help protect sensitive information effectively.
Enhancing FAQ...

Enhancing FAQ with AI recommendations...

AI Recommended Enhancement

Related Security Rules (click to view)
ApexBadCryptoApexCRUDViolationApexSharingViolationsAvoidHardcodedCredentialsInFieldDeclsAvoidHardcodedCredentialsInVarAssignAvoidHardcodedCredentialsInVarDeclsApexSuggestUsingNamedCred
Question
What is the secure way to store and mask credentials within a custom object?
Recommended Answer Update
To securely store and mask credentials within a custom object: Use AES symmetric encryption/decryption in Apex to encrypt the credentials, store the encryption key securely in Protected Custom Metadata, share the decrypted value only with authorized callers, and enforce proper CRUD/FLS and sharing checks in the Apex code to restrict access to the data. These steps help protect sensitive information effectively.
Reasoning
The existing answer is well-structured and covers the essential security practices. No content was found to be outdated or conflicting with the available security rules. The answer appropriately addresses encryption, secure key storage, access control, and permission enforcement. Related security rules selected: - **ApexBadCrypto**: The FAQ discusses using AES encryption in Apex, which directly relates to this rule that detects weak cryptographic practices - **ApexCRUDViolation**: The FAQ mentions enforcing "proper CRUD/FLS...checks" which is exactly what this rule validates - **ApexSharingViolations**: The FAQ mentions enforcing "sharing checks in the Apex code" which aligns with this rule's purpose - **AvoidHardcodedCredentialsInFieldDecls**: The FAQ addresses secure credential storage, and this rule prevents hardcoding credentials in field declarations - **AvoidHardcodedCredentialsInVarAssign**: Related to the FAQ's focus on secure credential handling, this rule prevents hardcoded credentials in variable assignments - **AvoidHardcodedCredentialsInVarDecls**: Complements the secure storage advice by preventing hardcoded credentials in variable declarations - **ApexSuggestUsingNamedCred**: While the FAQ discusses custom object storage, this rule suggests Named Credentials as an alternative secure approach for credential management
Reasoning References
Recommended Related Articles