• reettik mitra
  • NEWBIE
  • 15 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 3
    Replies
I was creating an application to publish in app exchange and so I had submitted the application for security review but the report cointained:-

We have completed the security review of your application. Unfortunately, we have found some issues which concern us, and thus, at this time we cannot approve your application for final listing.  Trust and security are core values at Salesforce, and we are committed to working with you to resolve those issues. The following vulnerabilities need to be resolved:
-Aura: Aysnc Code
-Sharing Violation
Can anyone explain the actual reasons for these issues?
I have successfully integrated the google api services and also i am abe to create .CSV fine in the google drive.But the data inside the CSV file is null(it must be due to incorrect or in proper body format). Please have a look at the code and tell me where to correct it.
Document doc = new Document(Name = 'documentName', Body = Blob.valueOf(csvFile),  Type = 'csv', ContentType='application/vnd.ms-excel');
Here the csvFile is string which contains the data of the CSV in proper format(including spaces and commas).I have used email and upload services to check the CSV file and recieved exactly what I wanted. So I used the following code for drive upload.
String boundary = 'SalesforceNewsTechnologyStuff';
String delimiter = '\r\n--' + boundary + '\r\n'; 
String close_delim = '\r\n--' + boundary + '--';
String bodyEncoded = EncodingUtil.base64Encode(doc.body);
String body = delimiter + 'Content-Type: application/json\r\n\r\n' + '{ "name" : "' + doc.Name + '",' + ' "mimeType" : "text/csv"}' + delimiter + 'Content-Type: text/application/vnd.ms-excel'  + '\r\n' + 'Content-Transfer-Encoding: base64\r\n' + '\r\n' + bodyEncoded + close_delim;
HttpRequest req = new HttpRequest();
req.setheader('Content-Length',String.valueOf(body.length()));
req.setheader('Content-Type','multipart/related; boundary='+boundary);
req.setMethod('POST'); 
req.setEndpoint('callout:Drive1'); 
req.setBody(body); 
Http h = new Http();
Httpresponse resp = h.send(req);
A blank csv gets created every time this code runs.Can any one suggest me how to add the data in the csv file?

 
I have sucess fully integrated with the AWS S3 for storing data.So basically I am trying to store the csv data generated from apex and want to store in AWS bucket .
Here is my code 
public static void StoreInAWS(String csvFile){
    Document doc = new Document(Name = 'documentName', Body = 
    Blob.valueOf(csvFile),  Type = 'csv', ContentType='application/vnd.ms-excel');
    system.debug(doc);
    String key = '';//mY key
    String secret = '';//my secret
    String formattedDateString = DateTime.now().formatGMT('EEE, dd MMM yyyy 
     HH:mm:ss z');
    String filename = 'folder/' + 'DocName ';//inside the bucket I have created a folder 
    named 'folder'
    String attachmentBody = csvFile;
    system.debug(attachmentBody);
    String bucketname = 'deletedrecords';//My bucket Name
    String host = 's3-us-east-1.amazonaws.com';
    system.debug('https://' + bucketname + '.' + host + '/' + filename);
    HttpRequest req = new HttpRequest();
   
    req.setMethod('PUT');
    req.setEndpoint('https://' + bucketname + '.' + host + '/'+ filename);
    req.setHeader('Host', bucketname + '.' + host);
    req.setHeader('Content-Length', String.valueOf(attachmentBody.length()));
    req.setHeader('Content-Type', doc.ContentType);
    req.setHeader('Connection', 'keep-alive');
    req.setHeader('Date', formattedDateString);
    req.setHeader('ACL', 'public-read-write');
    req.setBodyAsBlob(doc.body);
        
   // String stringToSign = 'PUT ' + doc.ContentType + '\n' + formattedDateString + '\n' + 
       '/' + bucketname + '/' + filename;
    //String encodedStringToSign = EncodingUtil.urlEncode(stringToSign, 'UTF-8');
   // Blob mac=Crypto.generateMac('HMACSHA1',blob.valueof(stringToSign),blob.valueof(secret));
    //String signedKey  = EncodingUtil.base64Encode(mac);
   // String authHeader = 'AWS' + ' ' + key + ':' + signedKey ;
    //req.setHeader('Authorization',authHeader);
    //String decoded = EncodingUtil.urlDecode(encodedStringToSign , 'UTF-8');
    system.debug('Sending the request');
    system.debug(req);
    Http http = new Http();
    HTTPResponse res = http.send(req);
    system.debug(res);
    System.debug(res.getBody());
}

getting this error-->
"unable to tunnel through proxy http/1.1 503 service unavailable"
 
When running this code in developer console then I am getting the output that is the full page code but when I am using the apex code in Lightning Web Component then I a getting the exact value that I want. Note:- LexSessionController provides the session Id When using LWC.

User-added image
 The Output I am getting Using the Lightning Web Component.
User-added imageThe Output I am getting Using the Developer Console(Which is correct and required).
String sfdcURL = URL.getSalesforceBaseUrl().toExternalForm();
String sessionId =  LexSessionController.fetchUserSessionId();
String sessionIdTrim=sessionId.substring(0,15); 
sfdcURL=sfdcURL+'/setup/org/orgstorageusage.jspid=&setupid='+sessionIdTrim+'CompanyResourceDisk&retURL=%2Fui%2Fsetup%2FSetup%3Fsetupid%3DDataManagement';
String html = new PageReference(sfdcURL).getContent().toString();

 
I have used LIMITS api but it returns the storage info in MB due to which if my max storage is 5MB and I have used 500kb then the remaining storage must be 4.5MB but the LIMITS API returns remaining5MB(rounded off).Is there any way that I can get the exact storage used by the organization. And I used site scraping on storage usage page in setup and recieved this error:-
"System.VisualforceException: org.apache.commons.httpclient.RedirectException: Maximum redirects (100) exceeded"
User-added imageUser-added image
when the user enters text and clicks on a button and then that text is sent to text to speech api which returns base64 text then the text is decoded and audio is given as output in the component. I have managed to get the response from the api which is in form of string .Now I dont know how to decode andconvert it to audio. Any Suggestions??
I was creating an application to publish in app exchange and so I had submitted the application for security review but the report cointained:-

We have completed the security review of your application. Unfortunately, we have found some issues which concern us, and thus, at this time we cannot approve your application for final listing.  Trust and security are core values at Salesforce, and we are committed to working with you to resolve those issues. The following vulnerabilities need to be resolved:
-Aura: Aysnc Code
-Sharing Violation
Can anyone explain the actual reasons for these issues?
I have sucess fully integrated with the AWS S3 for storing data.So basically I am trying to store the csv data generated from apex and want to store in AWS bucket .
Here is my code 
public static void StoreInAWS(String csvFile){
    Document doc = new Document(Name = 'documentName', Body = 
    Blob.valueOf(csvFile),  Type = 'csv', ContentType='application/vnd.ms-excel');
    system.debug(doc);
    String key = '';//mY key
    String secret = '';//my secret
    String formattedDateString = DateTime.now().formatGMT('EEE, dd MMM yyyy 
     HH:mm:ss z');
    String filename = 'folder/' + 'DocName ';//inside the bucket I have created a folder 
    named 'folder'
    String attachmentBody = csvFile;
    system.debug(attachmentBody);
    String bucketname = 'deletedrecords';//My bucket Name
    String host = 's3-us-east-1.amazonaws.com';
    system.debug('https://' + bucketname + '.' + host + '/' + filename);
    HttpRequest req = new HttpRequest();
   
    req.setMethod('PUT');
    req.setEndpoint('https://' + bucketname + '.' + host + '/'+ filename);
    req.setHeader('Host', bucketname + '.' + host);
    req.setHeader('Content-Length', String.valueOf(attachmentBody.length()));
    req.setHeader('Content-Type', doc.ContentType);
    req.setHeader('Connection', 'keep-alive');
    req.setHeader('Date', formattedDateString);
    req.setHeader('ACL', 'public-read-write');
    req.setBodyAsBlob(doc.body);
        
   // String stringToSign = 'PUT ' + doc.ContentType + '\n' + formattedDateString + '\n' + 
       '/' + bucketname + '/' + filename;
    //String encodedStringToSign = EncodingUtil.urlEncode(stringToSign, 'UTF-8');
   // Blob mac=Crypto.generateMac('HMACSHA1',blob.valueof(stringToSign),blob.valueof(secret));
    //String signedKey  = EncodingUtil.base64Encode(mac);
   // String authHeader = 'AWS' + ' ' + key + ':' + signedKey ;
    //req.setHeader('Authorization',authHeader);
    //String decoded = EncodingUtil.urlDecode(encodedStringToSign , 'UTF-8');
    system.debug('Sending the request');
    system.debug(req);
    Http http = new Http();
    HTTPResponse res = http.send(req);
    system.debug(res);
    System.debug(res.getBody());
}

getting this error-->
"unable to tunnel through proxy http/1.1 503 service unavailable"
 
I have used LIMITS api but it returns the storage info in MB due to which if my max storage is 5MB and I have used 500kb then the remaining storage must be 4.5MB but the LIMITS API returns remaining5MB(rounded off).Is there any way that I can get the exact storage used by the organization. And I used site scraping on storage usage page in setup and recieved this error:-
"System.VisualforceException: org.apache.commons.httpclient.RedirectException: Maximum redirects (100) exceeded"
User-added imageUser-added image