Skip to content

Commit 63ed6b9

Browse files
abhijitkanesnyk-botwebholik
authored
[Snyk] Security upgrade postman-collection from 3.6.11 to 4.0.0 (#638)
* fix: package.json & package-lock.json to reduce vulnerabilities The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-SANITIZEHTML-2957526 * Fix failing curl test * Fix failing java-unirest and swift unit tests --------- Co-authored-by: snyk-bot <[email protected]> Co-authored-by: Ankit Saini <[email protected]>
1 parent 2e9a4cd commit 63ed6b9

File tree

11 files changed

+632
-283
lines changed

11 files changed

+632
-283
lines changed

codegens/curl/lib/util.js

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ var self = module.exports = {
166166
url += urlObject.getPath();
167167
}
168168
if (urlObject.query && urlObject.query.count()) {
169-
let queryString = urlObject.getQueryString({ ignoreDisabled: true, encode: true });
169+
let queryString = self.getQueryString(urlObject);
170170
queryString && (url += '?' + queryString);
171171
}
172172
if (urlObject.hash) {
@@ -176,6 +176,49 @@ var self = module.exports = {
176176
return self.sanitize(url, false, quoteType);
177177
},
178178

179+
/**
180+
* @param {Object} urlObject
181+
* @returns {String}
182+
*/
183+
getQueryString: function (urlObject) {
184+
let isFirstParam = true,
185+
params = _.get(urlObject, 'query.members'),
186+
result = '';
187+
if (Array.isArray(params)) {
188+
result = _.reduce(params, function (result, param) {
189+
if (param.disabled === true) {
190+
return result;
191+
}
192+
193+
if (isFirstParam) {
194+
isFirstParam = false;
195+
}
196+
else {
197+
result += '&';
198+
}
199+
200+
return result + self.encodeParam(param.key) + '=' + self.encodeParam(param.value);
201+
}, result);
202+
}
203+
204+
return result;
205+
},
206+
207+
/**
208+
* Encode param except the following characters- [,{,},]
209+
*
210+
* @param {String} param
211+
* @returns {String}
212+
*/
213+
encodeParam: function (param) {
214+
return encodeURIComponent(param)
215+
.replace(/%5B/g, '[')
216+
.replace(/%7B/g, '{')
217+
.replace(/%5D/g, ']')
218+
.replace(/%7D/g, '}')
219+
.replace(/'/g, '%27');
220+
},
221+
179222
/**
180223
*
181224
* @param {Array} array - form data array

codegens/java-unirest/lib/parseRequest.js

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,49 @@ var _ = require('./lodash'),
22

33
sanitize = require('./util').sanitize;
44

5+
/**
6+
* Encode param except the following characters- [,{,},]
7+
*
8+
* @param {String} param
9+
* @returns {String}
10+
*/
11+
function encodeParam (param) {
12+
return encodeURIComponent(param)
13+
.replace(/%5B/g, '[')
14+
.replace(/%7B/g, '{')
15+
.replace(/%5D/g, ']')
16+
.replace(/%7D/g, '}')
17+
.replace(/'/g, '%27');
18+
}
19+
20+
/**
21+
* @param {Object} urlObject
22+
* @returns {String}
23+
*/
24+
function getQueryString (urlObject) {
25+
let isFirstParam = true,
26+
params = _.get(urlObject, 'query.members'),
27+
result = '';
28+
if (Array.isArray(params)) {
29+
result = _.reduce(params, function (result, param) {
30+
if (param.disabled === true) {
31+
return result;
32+
}
33+
34+
if (isFirstParam) {
35+
isFirstParam = false;
36+
}
37+
else {
38+
result += '&';
39+
}
40+
41+
return result + encodeParam(param.key) + '=' + encodeParam(param.value);
42+
}, result);
43+
}
44+
45+
return result;
46+
}
47+
548
/**
649
*
750
* @param {*} urlObject The request sdk request.url object
@@ -33,7 +76,7 @@ function getUrlStringfromUrlObject (urlObject) {
3376
url += urlObject.getPath();
3477
}
3578
if (urlObject.query && urlObject.query.count()) {
36-
let queryString = urlObject.getQueryString({ ignoreDisabled: true, encode: true });
79+
let queryString = getQueryString(urlObject);
3780
queryString && (url += '?' + queryString);
3881
}
3982
if (urlObject.hash) {

codegens/js-fetch/npm-shrinkwrap.json

Lines changed: 28 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codegens/js-xhr/npm-shrinkwrap.json

Lines changed: 47 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)