diff --git a/node_modules/got/dist/source/request-as-event-emitter.js b/node_modules/got/dist/source/request-as-event-emitter.js --- a/node_modules/got/dist/source/request-as-event-emitter.js +++ b/node_modules/got/dist/source/request-as-event-emitter.js @@ -103,8 +103,14 @@ } // Handles invalid URLs. See https://github.com/sindresorhus/got/issues/604 const redirectBuffer = Buffer.from(typedResponse.headers.location, 'binary').toString(); - const redirectUrl = new url_1.URL(redirectBuffer, options.url); - // Redirecting to a different site, clear cookies. + const redirectUrl = new url_1.URL(redirectBuffer, options.url); + // Upstream GHSA-pfrx-2q88-qq97: reject redirects from HTTP(S) to UNIX sockets. + const sourceIsUnixSocket = options.url.protocol === 'unix:' || options.url.hostname === 'unix'; + const redirectIsUnixSocket = redirectUrl.protocol === 'unix:' || redirectUrl.hostname === 'unix'; + if (!sourceIsUnixSocket && redirectIsUnixSocket) { + throw new errors_1.RequestError(new Error('Cannot redirect to UNIX socket'), options); + } + // Redirecting to a different site, clear cookies. if (redirectUrl.hostname !== options.url.hostname && Reflect.has(options.headers, 'cookie')) { delete options.headers.cookie; }