In the process of getting a managed package reviewed by Salesforce and it has been flagged for Insecure Storage of Sensitive Data and they highlight the following xml.
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<customSettingsType>List</customSettingsType>
<enableFeeds>false</enableFeeds>
<fields>
<fullName>Client_Id__c</fullName>
<deprecated>false</deprecated>
<externalId>false</externalId>
<label>Client Id</label>
<length>100</length>
<required>false</required>
<trackTrending>false</trackTrending>
<type>Text</type>
<unique>false</unique>
</fields>
<fields>
<fullName>Client_Secret__c</fullName>
<deprecated>false</deprecated>
<externalId>false</externalId>
<label>Client Secret</label>
<required>false</required>
<trackTrending>false</trackTrending>
<type>TextArea</type>
</fields>
<label>ConnectedApp</label>
**<visibility>Public</visibility>**
</CustomObject>
Notes Sensitive data like Client_Id__c and Client_Secret__c which is use in api call, should be stored in a protected custom setting or named credential.
Related Code
public class CRMA_AuthenticationCheck {
...
@AuraEnabled
public static ResponseWrapper authorizeCRMA(String session_id, String userId, String consumerSecret){
ResponseWrapper rw = new ResponseWrapper();
string successMsg;
string crmaUrl;
ConnectedApp__c conApp;
try{
Boolean isStaging = [SELECT Id, IsSandbox FROM Organization LIMIT 1].IsSandbox;
if(isStaging){
crmaUrl = 'https://salesforcestaging.mydummysite.com/index.php/logincb/';
}else{
crmaUrl = 'https://salesforce.mydummysite.com/index.php/logincb/';
}
conApp = ConnectedAppCreator.createConnectedApp(crmaUrl+userId);
Boolean isSuccess = false;
if(String.isBlank(consumerSecret)){
consumerSecret = conApp.Client_Secret__c;
}
if(String.isBlank(consumerSecret)){
rw.StatusCode = 120;
rw.ResponseMessage = 'Please Enter the Consumer Secret from Connected App with name Foo Connected App' ;
rw.toastType = 'dismissable';
return rw;
}else {
conApp.Client_Secret__c = consumerSecret;
}
if(conApp != null && String.isNotBlank(conApp.Client_Id__c)){
successMsg = ConnectedAppDetailsToCRMA.connectedAppDetails(conApp.Client_Id__c, consumerSecret,UserInfo.getOrganizationName(), userId, session_id);
if(successMsg == 'SUCCESSFUL'){
isSuccess = true;
}
}
...
}
...
return rw;
}
...
}
Given that the managed package is generated and we are not specifically defining ConnectedApp, don't see how we can modify the field visibility to private or protected. Any link or relevant samples are appreciated. Thank you !