Skip to content

Commit 3352fb1

Browse files
committed
MLE-17209 : Review and fix vulnerabilities in Polaris report for Node Client.
1 parent 7601482 commit 3352fb1

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

lib/patch-builder.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ function replaceInsert() {
538538
continue;
539539
}
540540
}
541-
if (apply === null || apply === undefined) {
541+
if (arg && !apply) {
542542
apply = arg.apply;
543543
if (apply != null) {
544544
content = arg.content;

lib/resources-exec.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,24 @@ function makeRequestOptions(client, args) {
5454
var value = null;
5555
var j=0;
5656
for (; i < keyLen; i++) {
57-
key = keys[i];
58-
value = params[key];
59-
if (Array.isArray(value)) {
60-
prefix = sep+encodeURIComponent('rs:'+key)+'=';
61-
for (j=0; j < value.length; j++) {
62-
path += prefix+encodeURIComponent(value[j]);
63-
if (i === 0 && j === 0) {
57+
key = keys?keys[i]:null;
58+
if(params){
59+
value = params[key];
60+
if (Array.isArray(value)) {
61+
prefix = sep+encodeURIComponent('rs:'+key)+'=';
62+
for (j=0; j < value.length; j++) {
63+
path += prefix+encodeURIComponent(value[j]);
64+
if (i === 0 && j === 0) {
65+
sep ='&';
66+
prefix = sep+encodeURIComponent('rs:'+key)+'=';
67+
}
68+
}
69+
} else {
70+
path += sep+'rs:'+key+'='+encodeURIComponent(value);
71+
if (i === 0) {
6472
sep ='&';
65-
prefix = sep+encodeURIComponent('rs:'+key)+'=';
6673
}
6774
}
68-
} else {
69-
path += sep+'rs:'+key+'='+encodeURIComponent(value);
70-
if (i === 0) {
71-
sep ='&';
72-
}
7375
}
7476
}
7577

lib/responder.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function responseDispatcher(response) {
5555
}
5656

5757
var responseType = response.headers['content-type'];
58-
var responseTypeLen = (responseType === undefined) ? 0 : responseType.length;
58+
var responseTypeLen = (!responseType) ? 0 : responseType.length;
5959
var responseBoundary = null;
6060
if (15 <= responseTypeLen && responseType.substr(0, 15) === 'multipart/mixed') {
6161
responseBoundary = responseType.replace(

0 commit comments

Comments
 (0)