mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2026-10-19 14:04:32 +07:00
node_modules: update (#347)
Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
1 parent
16c91eb93f
commit
f6664f2182
10 files changed
+155
-60
No files matched your search
+16
-10
@@ -78,6 +78,10 @@ function parseFetchUrl(url) {
|
||||
}
|
||||
return parsed;
|
||||
}
|
||||
// the port a request to the URL goes to, explicit or the default of its scheme
|
||||
function fetchPort(parsed) {
|
||||
return parsed.port ? Number(parsed.port) : parsed.protocol === 'https:' ? 443 : 80;
|
||||
}
|
||||
function nmfetch(url, options) {
|
||||
options = options || {};
|
||||
options.fetchRes = options.fetchRes || new PassThrough();
|
||||
@@ -194,7 +198,7 @@ function nmfetch(url, options) {
|
||||
method,
|
||||
host: parsed.hostname,
|
||||
path: parsed.path,
|
||||
port: parsed.port ? parsed.port : parsed.protocol === 'https:' ? 443 : 80,
|
||||
port: fetchPort(parsed),
|
||||
headers,
|
||||
// Validate TLS certificates by default. Callers that genuinely need to
|
||||
// reach a self-signed/internal host opt out explicitly with
|
||||
@@ -296,17 +300,19 @@ function nmfetch(url, options) {
|
||||
// the shared fetchRes once it times out. Callers listen with req.once().
|
||||
return fail(new Error('Unsupported protocol for URL ' + redirectUrl), redirectUrl);
|
||||
}
|
||||
// Do not forward credentials when the redirect leaves the original
|
||||
// security context: a different host, or a downgrade from https to
|
||||
// http (which would otherwise put them on the wire in cleartext).
|
||||
// Strip sensitive request headers so an attacker who controls the
|
||||
// redirect target cannot harvest them.
|
||||
const crossHost = redirectParsed.hostname !== parsed.hostname;
|
||||
const downgrade = parsed.protocol === 'https:' && redirectParsed.protocol === 'http:';
|
||||
if (options.headers && (crossHost || downgrade)) {
|
||||
// Do not forward credentials when the redirect leaves the origin: a different
|
||||
// scheme, host or port is a different security context (an https to http
|
||||
// downgrade would also put them on the wire in cleartext). Strip sensitive
|
||||
// request headers so an attacker who controls the redirect target cannot
|
||||
// harvest them.
|
||||
const crossOrigin = redirectParsed.protocol !== parsed.protocol ||
|
||||
redirectParsed.hostname !== parsed.hostname ||
|
||||
fetchPort(redirectParsed) !== fetchPort(parsed);
|
||||
if (options.headers && crossOrigin) {
|
||||
const sensitive = ['authorization', 'cookie', 'proxy-authorization'];
|
||||
Object.keys(options.headers).forEach(key => {
|
||||
if (sensitive.includes(key.toLowerCase())) {
|
||||
// normalized the way the request headers are built above, a padded name is sent too
|
||||
if (sensitive.includes(key.toLowerCase().trim())) {
|
||||
delete options.headers[key];
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user