diff --git a/package.json b/package.json index b8574ee98..318bf2823 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "mkdirp": "0.5.2", "moment": "2.21.0", "mustache": "2.3.0", - "node-fetch": "https://github.com/scottnonnenberg-signal/node-fetch.git#3e5f51e08c647ee5f20c43b15cf2d352d61c36b4", + "node-fetch": "2.6.0", "node-gyp": "5.0.3", "normalize-path": "3.0.0", "os-locale": "3.0.1", @@ -144,9 +144,6 @@ "websocket": "1.0.28", "zkgroup": "https://github.com/signalapp/signal-zkgroup-node.git#2d7db946cc88492b65cc66e9aa9de0c9e664fd8d" }, - "resolutions": { - "fbjs/isomorphic-fetch/node-fetch": "https://github.com/scottnonnenberg-signal/node-fetch.git#3e5f51e08c647ee5f20c43b15cf2d352d61c36b4" - }, "devDependencies": { "@babel/core": "7.7.7", "@babel/plugin-proposal-class-properties": "7.7.4", @@ -177,7 +174,7 @@ "@types/memoizee": "0.4.2", "@types/mkdirp": "0.5.2", "@types/mocha": "5.0.0", - "@types/node-fetch": "2.5.5", + "@types/node-fetch": "2.5.7", "@types/normalize-path": "3.0.0", "@types/pify": "3.0.2", "@types/qs": "6.5.1", diff --git a/patches/node-fetch+2.6.0.patch b/patches/node-fetch+2.6.0.patch new file mode 100644 index 000000000..992c4d337 --- /dev/null +++ b/patches/node-fetch+2.6.0.patch @@ -0,0 +1,36 @@ +diff --git a/node_modules/node-fetch/lib/index.es.js b/node_modules/node-fetch/lib/index.es.js +index 37d022c..d3199df 100644 +--- a/node_modules/node-fetch/lib/index.es.js ++++ b/node_modules/node-fetch/lib/index.es.js +@@ -1398,6 +1398,7 @@ function fetch(url, opts) { + // build request object + const request = new Request(url, opts); + const options = getNodeRequestOptions(request); ++ options.ca = opts.ca; + + const send = (options.protocol === 'https:' ? https : http).request; + const signal = request.signal; +diff --git a/node_modules/node-fetch/lib/index.js b/node_modules/node-fetch/lib/index.js +index daa44bc..9edbbd3 100644 +--- a/node_modules/node-fetch/lib/index.js ++++ b/node_modules/node-fetch/lib/index.js +@@ -1402,6 +1402,7 @@ function fetch(url, opts) { + // build request object + const request = new Request(url, opts); + const options = getNodeRequestOptions(request); ++ options.ca = opts.ca; + + const send = (options.protocol === 'https:' ? https : http).request; + const signal = request.signal; +diff --git a/node_modules/node-fetch/lib/index.mjs b/node_modules/node-fetch/lib/index.mjs +index e571ea6..67399a0 100644 +--- a/node_modules/node-fetch/lib/index.mjs ++++ b/node_modules/node-fetch/lib/index.mjs +@@ -1396,6 +1396,7 @@ function fetch(url, opts) { + // build request object + const request = new Request(url, opts); + const options = getNodeRequestOptions(request); ++ options.ca = opts.ca; + + const send = (options.protocol === 'https:' ? https : http).request; + const signal = request.signal; diff --git a/ts/textsecure/WebAPI.ts b/ts/textsecure/WebAPI.ts index 09da06941..1e8c05d9c 100644 --- a/ts/textsecure/WebAPI.ts +++ b/ts/textsecure/WebAPI.ts @@ -325,7 +325,7 @@ async function _promiseAjax( ) { resultPromise = response.buffer(); } else { - resultPromise = response.text(); + resultPromise = response.textConverted(); } return resultPromise.then(result => { diff --git a/ts/util/lint/exceptions.json b/ts/util/lint/exceptions.json index 88fb195f9..a28c4de06 100644 --- a/ts/util/lint/exceptions.json +++ b/ts/util/lint/exceptions.json @@ -9304,11 +9304,187 @@ }, { "rule": "jQuery-append(", - "path": "node_modules/node-fetch/lib/headers.js", + "path": "node_modules/isomorphic-fetch/node_modules/node-fetch/lib/headers.js", "line": "\t\t\t\tself.append(prop, item.toString());", "lineNumber": 40, "reasonCategory": "falseMatch", - "updated": "2018-09-19T18:13:29.628Z" + "updated": "2020-08-11T15:42:40.409Z" + }, + { + "rule": "jQuery-append(", + "path": "node_modules/isomorphic-fetch/node_modules/node-fetch/lib/index.js", + "line": "\t\t\t\t\tthis.append(headerName, value);", + "lineNumber": 729, + "reasonCategory": "falseMatch", + "updated": "2020-08-11T15:42:35.324Z" + }, + { + "rule": "jQuery-append(", + "path": "node_modules/isomorphic-fetch/node_modules/node-fetch/lib/index.js", + "line": "\t\t// We don't worry about converting prop to ByteString here as append()", + "lineNumber": 736, + "reasonCategory": "falseMatch", + "updated": "2020-08-11T15:42:35.324Z" + }, + { + "rule": "jQuery-append(", + "path": "node_modules/isomorphic-fetch/node_modules/node-fetch/lib/index.js", + "line": "\t\t\t\t\tthis.append(pair[0], pair[1]);", + "lineNumber": 761, + "reasonCategory": "falseMatch", + "updated": "2020-08-11T15:42:35.324Z" + }, + { + "rule": "jQuery-append(", + "path": "node_modules/isomorphic-fetch/node_modules/node-fetch/lib/index.js", + "line": "\t\t\t\t\tthis.append(key, value);", + "lineNumber": 767, + "reasonCategory": "falseMatch", + "updated": "2020-08-11T15:42:35.324Z" + }, + { + "rule": "jQuery-append(", + "path": "node_modules/isomorphic-fetch/node_modules/node-fetch/lib/index.js", + "line": "\tappend(name, value) {", + "lineNumber": 838, + "reasonCategory": "falseMatch", + "updated": "2020-08-11T15:42:35.324Z" + }, + { + "rule": "jQuery-append(", + "path": "node_modules/isomorphic-fetch/node_modules/node-fetch/lib/index.js", + "line": "\t\t\t\tthis.headers.append('Content-Type', contentType);", + "lineNumber": 1118, + "reasonCategory": "falseMatch", + "updated": "2020-08-11T15:42:35.324Z" + }, + { + "rule": "jQuery-append(", + "path": "node_modules/isomorphic-fetch/node_modules/node-fetch/lib/index.js", + "line": "\t\t\t\t\t\theaders.append(name, val);", + "lineNumber": 1320, + "reasonCategory": "falseMatch", + "updated": "2020-08-11T15:42:35.324Z" + }, + { + "rule": "jQuery-append(", + "path": "node_modules/isomorphic-fetch/node_modules/node-fetch/lib/index.js", + "line": "\t\t\t\t\theaders.append(name, res.headers[name]);", + "lineNumber": 1323, + "reasonCategory": "falseMatch", + "updated": "2020-08-11T15:42:35.324Z" + }, + { + "rule": "jQuery-append(", + "path": "node_modules/node-fetch/lib/index.es.js", + "line": "\t\t\t\t\tthis.append(headerName, value);", + "lineNumber": 714, + "reasonCategory": "falseMatch", + "updated": "2020-08-11T15:42:35.324Z" + }, + { + "rule": "jQuery-append(", + "path": "node_modules/node-fetch/lib/index.es.js", + "line": "\t\t// We don't worry about converting prop to ByteString here as append()", + "lineNumber": 721, + "reasonCategory": "falseMatch", + "updated": "2020-08-11T15:42:35.324Z" + }, + { + "rule": "jQuery-append(", + "path": "node_modules/node-fetch/lib/index.es.js", + "line": "\t\t\t\t\tthis.append(pair[0], pair[1]);", + "lineNumber": 744, + "reasonCategory": "falseMatch", + "updated": "2020-08-11T15:42:35.324Z" + }, + { + "rule": "jQuery-append(", + "path": "node_modules/node-fetch/lib/index.es.js", + "line": "\t\t\t\t\tthis.append(key, value);", + "lineNumber": 750, + "reasonCategory": "falseMatch", + "updated": "2020-08-11T15:42:35.324Z" + }, + { + "rule": "jQuery-append(", + "path": "node_modules/node-fetch/lib/index.es.js", + "line": "\tappend(name, value) {", + "lineNumber": 821, + "reasonCategory": "falseMatch", + "updated": "2020-08-11T15:42:35.324Z" + }, + { + "rule": "jQuery-append(", + "path": "node_modules/node-fetch/lib/index.es.js", + "line": "\t\t\t\theaders.append('Content-Type', contentType);", + "lineNumber": 1057, + "reasonCategory": "falseMatch", + "updated": "2020-08-11T15:42:35.324Z" + }, + { + "rule": "jQuery-append(", + "path": "node_modules/node-fetch/lib/index.es.js", + "line": "\t\t\t\theaders.append('Content-Type', contentType);", + "lineNumber": 1204, + "reasonCategory": "falseMatch", + "updated": "2020-08-11T15:42:35.324Z" + }, + { + "rule": "jQuery-append(", + "path": "node_modules/node-fetch/lib/index.js", + "line": "\t\t\t\t\tthis.append(headerName, value);", + "lineNumber": 718, + "reasonCategory": "falseMatch", + "updated": "2020-08-11T15:42:35.324Z" + }, + { + "rule": "jQuery-append(", + "path": "node_modules/node-fetch/lib/index.js", + "line": "\t\t// We don't worry about converting prop to ByteString here as append()", + "lineNumber": 725, + "reasonCategory": "falseMatch", + "updated": "2020-08-11T15:42:35.324Z" + }, + { + "rule": "jQuery-append(", + "path": "node_modules/node-fetch/lib/index.js", + "line": "\t\t\t\t\tthis.append(pair[0], pair[1]);", + "lineNumber": 748, + "reasonCategory": "falseMatch", + "updated": "2020-08-11T15:42:35.324Z" + }, + { + "rule": "jQuery-append(", + "path": "node_modules/node-fetch/lib/index.js", + "line": "\t\t\t\t\tthis.append(key, value);", + "lineNumber": 754, + "reasonCategory": "falseMatch", + "updated": "2020-08-11T15:42:35.324Z" + }, + { + "rule": "jQuery-append(", + "path": "node_modules/node-fetch/lib/index.js", + "line": "\tappend(name, value) {", + "lineNumber": 825, + "reasonCategory": "falseMatch", + "updated": "2020-08-11T15:42:35.324Z" + }, + { + "rule": "jQuery-append(", + "path": "node_modules/node-fetch/lib/index.js", + "line": "\t\t\t\theaders.append('Content-Type', contentType);", + "lineNumber": 1061, + "reasonCategory": "falseMatch", + "updated": "2020-08-11T15:42:35.324Z" + }, + { + "rule": "jQuery-append(", + "path": "node_modules/node-fetch/lib/index.js", + "line": "\t\t\t\theaders.append('Content-Type', contentType);", + "lineNumber": 1208, + "reasonCategory": "falseMatch", + "updated": "2020-08-11T15:42:35.324Z" }, { "rule": "jQuery-$(", diff --git a/yarn.lock b/yarn.lock index 7fc14f16f..5efbfce46 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2291,10 +2291,10 @@ resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-5.0.0.tgz#a3014921991066193f6c8e47290d4d598dfd19e6" integrity sha512-ZS0vBV7Jn5Z/Q4T3VXauEKMDCV8nWOtJJg90OsDylkYJiQwcWtKuLzohWzrthBkerUF7DLMmJcwOPEP0i/AOXw== -"@types/node-fetch@2.5.5": - version "2.5.5" - resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.5.tgz#cd264e20a81f4600a6c52864d38e7fef72485e92" - integrity sha512-IWwjsyYjGw+em3xTvWVQi5MgYKbRs0du57klfTaZkv/B24AEQ/p/IopNeqIYNy3EsfHOpg8ieQSDomPcsYMHpA== +"@types/node-fetch@2.5.7": + version "2.5.7" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.7.tgz#20a2afffa882ab04d44ca786449a276f9f6bbf3c" + integrity sha512-o2WVNf5UhWRkxlf6eq+jMZDu7kjgpgJfl4xVNlvryc95O/6F2ld8ztKX+qu+Rjyet93WAWm5LjeX9H5FGkODvw== dependencies: "@types/node" "*" form-data "^3.0.0" @@ -11568,18 +11568,19 @@ node-environment-flags@1.0.5: object.getownpropertydescriptors "^2.0.3" semver "^5.7.0" -node-fetch@^1.0.1, "node-fetch@https://github.com/scottnonnenberg-signal/node-fetch.git#3e5f51e08c647ee5f20c43b15cf2d352d61c36b4": - version "1.7.3" - resolved "https://github.com/scottnonnenberg-signal/node-fetch.git#3e5f51e08c647ee5f20c43b15cf2d352d61c36b4" - dependencies: - encoding "^0.1.11" - is-stream "^1.0.1" - -node-fetch@^2.6.0: +node-fetch@2.6.0, node-fetch@^2.6.0: version "2.6.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== +node-fetch@^1.0.1: + version "1.7.3" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" + integrity sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ== + dependencies: + encoding "^0.1.11" + is-stream "^1.0.1" + node-forge@0.7.1: version "0.7.1" resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.7.1.tgz#9da611ea08982f4b94206b3beb4cc9665f20c300"