We have received this issue in our security review "Insecure Storage of Sensitive Data Vulnerability ".
I am making a call to external service to get a encrypted claim that i am using to login into a iframe.
We are not storing any sensitive information in salesforce. Only place where we are storing this encrypted claim is in js variable.
Is this false positive or i am missing something here.
Here is HTML code
<form id="helperForm" target="name" method="post" action= {hostUrlLogin}>
<input id="targetUrl" type="hidden" name="targetUrl" value={targetUrl}/>
<input id="ssoProvider" type="hidden" name="ssoProvider" value={ssoProvider}/>
<input id="encryptedClaims" type="hidden" name="encryptedClaims" value={encryptedClaim}/>
</form>
Js code
Promise.all([
getAnalyticsSetting({
customDashboard : this.dashboardId,
recordId: this.recordId
}),
getPGPKey()
]).then(data => {
if(data[0] && data[1]){
this.encryptedClaim = data[1];
this.targetUrl = data[0].url;
this.iframeHeight = data[0].dashboardHeight;
this.hostUrlLogin = data[0].hostUrl + 'xxxxx';
this.template.querySelector("form").submit();
// some logic to show dashboard.
} else if(!data[0]){
this.analyticsSetingPresent = false;
}
})
and apex code
@AuraEnabled
public static string getPGPKey(){
try {
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('xxxxxx');
request.setMethod('POST');
request.setHeader('x-api-key', 'xxxxxx');
request.setHeader('content-type', 'application/json');
Long plusOneDate = DateTime.now().addDays(1).getTime() / 1000;
Long nowTime = DateTime.now().getTime() / 1000;
JSONGenerator gen = JSON.createGenerator(true);
gen.writeStartObject();
gen.writeStringField('ssoProvider', 'xxxx');
gen.writeFieldName('claims');
gen.writeStartObject();
gen.writeStringField('email', UserInfo.getUserEmail());
gen.writeEndObject();
gen.writeEndObject();
request.setBody(gen.getAsString());
HttpResponse response = http.send(request);
return (String)response.getBody();
}catch (exception e){
throw new AuraHandledException(e.getMessage());
}
}