Read-only mirror — the public repositories of the Forgejo instance, refreshed every 10 minutes. The live instance (fg.dieschoenewolke.de) is reachable only over the VPN; clone here with https://git.dieschoenewolke.de/git/<owner>/<repo>.git.
summaryrefslogtreecommitdiff
path: root/dist
diff options
context:
space:
mode:
authorTingluo Huang <tingluohuang@github.com>2022-04-05 13:01:33 -0400
committerGitHub <noreply@github.com>2022-04-05 13:01:33 -0400
commit012cfe073cd6a3e62be7509ec0e8116719433e77 (patch)
treeab0d5835dafcb3b159bd19d7ed3fbadd9016a9d4 /dist
parent8b720423660572cb44a4b6bc8f4b99c8cccd256d (diff)
Patch to fix the dependbot alert. (#744)
* Patch to fix the dependbot alert. * . * . * .
Diffstat (limited to 'dist')
-rw-r--r--dist/index.js32
1 files changed, 29 insertions, 3 deletions
diff --git a/dist/index.js b/dist/index.js
index 1dab10c..271b054 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -10195,7 +10195,7 @@ Object.defineProperty(Response.prototype, Symbol.toStringTag, {
});
const INTERNALS$2 = Symbol('Request internals');
-const URL = whatwgUrl.URL;
+const URL = Url.URL || whatwgUrl.URL;
// fix an issue where "format", "parse" aren't a named export for node <10
const parse_url = Url.parse;
@@ -10458,9 +10458,17 @@ AbortError.prototype = Object.create(Error.prototype);
AbortError.prototype.constructor = AbortError;
AbortError.prototype.name = 'AbortError';
+const URL$1 = Url.URL || whatwgUrl.URL;
+
// fix an issue where "PassThrough", "resolve" aren't a named export for node <10
const PassThrough$1 = Stream.PassThrough;
-const resolve_url = Url.resolve;
+
+const isDomainOrSubdomain = function isDomainOrSubdomain(destination, original) {
+ const orig = new URL$1(original).hostname;
+ const dest = new URL$1(destination).hostname;
+
+ return orig === dest || orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest);
+};
/**
* Fetch function
@@ -10548,7 +10556,19 @@ function fetch(url, opts) {
const location = headers.get('Location');
// HTTP fetch step 5.3
- const locationURL = location === null ? null : resolve_url(request.url, location);
+ let locationURL = null;
+ try {
+ locationURL = location === null ? null : new URL$1(location, request.url).toString();
+ } catch (err) {
+ // error here can only be invalid URL in Location: header
+ // do not throw when options.redirect == manual
+ // let the user extract the errorneous redirect URL
+ if (request.redirect !== 'manual') {
+ reject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, 'invalid-redirect'));
+ finalize();
+ return;
+ }
+ }
// HTTP fetch step 5.5
switch (request.redirect) {
@@ -10596,6 +10616,12 @@ function fetch(url, opts) {
size: request.size
};
+ if (!isDomainOrSubdomain(request.url, locationURL)) {
+ for (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) {
+ requestOpts.headers.delete(name);
+ }
+ }
+
// HTTP-redirect fetch step 9
if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) {
reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect'));