FAQ-000490 - Custom Settings and Configuration Security / Protected Custom Settings Security Requirements and Best Practices

Current Status:VALID_RESPONSEErrorUnable to AnswerSuggests Case

Current FAQ

Question
Is using protected custom settings with post-install scripts a secure method for storing OAuth credentials and consumer secrets?
Answer
Yes, using protected custom settings with post-install scripts can be a secure method for storing OAuth credentials if implemented correctly. Here are some key considerations: 1. **Secure Post-Install Scripts**: Post-install scripts run with elevated privileges, so ensure they are not declared as global to minimize security risks. 2. **Restrict Access**: Limit access to the protected custom settings to authorized users only. 3. **Provide a Secure UI**: Since protected custom settings lack a built-in interface, create a secure UI for managing these settings. 4. **Include Management Code**: Your application must include the necessary code to manage and update the protected custom settings, as they lack a built-in GUI interface. By following these practices, you can securely store OAuth credentials using protected custom settings.
Enhancing FAQ...

Enhancing FAQ with AI recommendations...

AI Recommended Enhancement

Related Security Rules (click to view)
ApexSuggestUsingNamedCredAvoidGlobalInstallUninstallHandlersAvoidHardcodedCredentialsInFieldDeclsAvoidHardcodedCredentialsInVarAssignAvoidHardcodedCredentialsInVarDecls
Question
Is using protected custom settings with post-install scripts a secure method for storing OAuth credentials and consumer secrets?
Recommended Answer Update
Yes, using protected custom settings with post-install scripts can be a secure method for storing OAuth credentials if implemented correctly. Here are some key considerations: 1. **Secure Post-Install Scripts**: Post-install scripts run with elevated privileges, so ensure they're not declared as global to minimize security risks. 2. **Restrict Access**: Limit access to the protected custom settings to authorized users only. 3. **Provide a Secure UI**: Since protected custom settings lack a built-in interface, create a secure UI for managing these settings. 4. **Include Management Code**: Your application must include the necessary code to manage and update the protected custom settings, as they lack a built-in GUI interface. By following these practices, you can securely store OAuth credentials using protected custom settings.
Reasoning
Made one minor grammatical improvement by changing 'ensure they are not declared' to 'ensure they're not declared' to follow the conversational tone guidelines. Selected multiple security rules that relate to credential storage and management: ApexSuggestUsingNamedCred relates to OAuth credentials mentioned in the FAQ as it suggests using named credentials for external authentication; AvoidGlobalInstallUninstallHandlers directly relates to point 1 about not declaring post-install scripts as global; AvoidHardcodedCredentialsInFieldDecls, AvoidHardcodedCredentialsInVarAssign, and AvoidHardcodedCredentialsInVarDecls all relate to the FAQ's focus on securely storing OAuth credentials and consumer secrets, as these rules help prevent hardcoding such sensitive information in code.
Reasoning References