Hey Everyone, Our webstore is currently running on...
# suitecommerce
d
Hey Everyone, Our webstore is currently running on 2019.1 recently found an article in Suiteanswers regarding a vulnerability CVE-2020-14728. The article talks about overriding code in servicecontroller.js but when I do this it breaks the error messages Original Code:
Copy code
var content = {
errorStatusCode: parseInt(status,10).toString()
, errorCode: code
, errorMessage: message
}
Suggested code in the article:
Copy code
var content = {
   errorStatusCode: parseInt(status, 10).toString(),
   errorCode: code,
   errorMessage: _.escape(message)
};
Does anybody have idea on what is this vulnerability and how this code addresses it? and why the error messages are breaking ? Thanks in Advance. We also raised a support case on this support case number 3930593 .
Attaching the screen shot relating to above error
k
We looked at the patch - the code to be replaced uses “const” instead of var. The ns,package json didn’t include SuiteScript files as per the example. We applied the patch, the override was successful accodring to terminal, but unable to deploy because of a ts error.
s
I cannot give an official position on this as I've yet to receive word back from the developers, but my understanding is that the instructions given for ns.package.json are incorrect (thanks to Kerrie for pointing that out).
So where we have
Copy code
{
   "gulp": {
      "javascript": [
         "JavaScript/*.js"
      ]
   },
   "overrides": {
      "suitecommerce/SspLibraries@X.Y.Z/SuiteScript/ServiceController.js" : "SuiteScript/ServiceController.js"
   }
}
We should have instead said:
Copy code
{
  "gulp": {
    "ssp-libraries": [
      "SuiteScript/*.js"
    ]
  }
 ,  "overrides": {
    "suitecommerce/SspLibraries@x.y.z/SuiteScript/ServiceController.js" : "SuiteScript/ServiceController.js"
  }
 }
But as I said, this is not official yet. You should continue with your support case and heed their advice.
k
yep - got that part - its the ts error that remains - any news on that? I may need to add to that case
oh, and the const vs var….it should stay const I assume…
s
I don't, personally, see a reason for using
const
over
var
. And no, I've not heard anything about the TS thing
k
ok - I think keep const to match the original is what I think we will do.
d
Hi @Steve Goldberg @kkennedydesign Thanks for your views I replaced the code in ns.package.json as mentioned above. I still see the error messaging break
k
surprised you actually got it to deploy
however, I am having problems on 2019.2 not 2019.1
have not tried 2019.1 yet
w
Curious, should those variable declared as 'var' since the ServiceController.js is written in 1.0? or are you writing an extension with SS2.0?
k
this is an override of a core NS file that includes const
p
@Durgasree the error message breaks because in ServiceController.js the replaced code contains _.escape for the message
d
@Paper Plane Netsuite Group Thanks for the input. I thought so too but support rep said he was not able to replicate the issue with "base theme" and this issue is replicated only through "custom theme". Our custom theme is of 18.2 version and SSP is of 19.1 version I'm thinking if that could be reason too. Also, this _.escape method is what was recommended to address the vulnerability
f
To fix the error message showing HTML instead of a link try the following: 1.Go to Backbone.FormView a. Add a method call transformResponseText.
Copy code
transformResponseText: function(response) {},
b. Go to the method saveForm. Go to the line where the error response of the model.save is processed, below the if condition add this line 
Copy code
self.transformResponseText(response).
It should look like this:
Copy code
if (response.responseText) {
self.transformResponseText(response);
// code
} 2. For the issue showing up on the screenshot you attached the fix is to go to the LoginRegister.Login.View and add this method:
Copy code
transformResponseText: function(response) {
response.responseText = _.unescape(response.responseText);
}
If this issue shows up in another page, you will need to go the View that calls the method saveForm that shows the HTML error and add this method:
Copy code
transformResponseText: function(response) {
response.responseText = _.unescape(response.responseText);
}