salesforce - Salesforce 托管包安全审查,如何将包含敏感数据的自定义设置字段可见性更改为私有或受保护?
问题描述
在 Salesforce 审查托管包的过程中,它已被标记为敏感数据的不安全存储,他们突出显示以下 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>
注意 api 调用中使用的 Client_Id__c 和 Client_Secret__c 等敏感数据应存储在受保护的自定义设置或命名凭据中。
相关代码
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;
}
...
}
鉴于生成了托管包并且我们没有专门定义 ConnectedApp,因此看不到我们如何将字段可见性修改为私有或受保护。任何链接或相关样本表示赞赏。谢谢 !
解决方案
推荐阅读
- java - 什么设置了 Java 中的默认字节数组编码?
- json - 我的 JSON 解码器不工作,我不知道为什么
- c# - 在 Linq 中将列表默认为 Null
- r - 如何创建一个 for 循环来计算向量中位于设定边界之间的值的数量?
- nativescript - 如何从 Nativescript/JS 中的 ListView 点击事件传递/接收项目详细信息?
- docker - 如何在 Fedora Docker 上使用“ping”
- r - 列表列的逐行比较
- c# - 如何将包含对象的实体投射到 AutoMapper 中的其他实体?
- java - 从表中抓取一个项目并在 SpringBoot/Thymeleaf 中以模态方式对其进行编辑
- react-native - 如何在特定页面上显示来自 JSON 的特定对象?