Skip to content

Commit b9da3e4

Browse files
authored
Merge pull request from GHSA-3787-6prv-h9w3
Signed-off-by: Matteo Collina <hello@matteocollina.com>
1 parent 5db527a commit b9da3e4

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/fetch/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,6 +1326,9 @@ function httpRedirectFetch (fetchParams, response) {
13261326
// https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name
13271327
request.headersList.delete('authorization', true)
13281328

1329+
// https://fetch.spec.whatwg.org/#authentication-entries
1330+
request.headersList.delete('proxy-authorization', true)
1331+
13291332
// "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement.
13301333
request.headersList.delete('cookie', true)
13311334
request.headersList.delete('host', true)

test/fetch/redirect-cross-origin-header.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ const { once } = require('node:events')
77
const { fetch } = require('../..')
88

99
test('Cross-origin redirects clear forbidden headers', async (t) => {
10-
const { strictEqual } = tspl(t, { plan: 5 })
10+
const { strictEqual } = tspl(t, { plan: 6 })
1111

1212
const server1 = createServer((req, res) => {
1313
strictEqual(req.headers.cookie, undefined)
1414
strictEqual(req.headers.authorization, undefined)
15+
strictEqual(req.headers['proxy-authorization'], undefined)
1516

1617
res.end('redirected')
1718
}).listen(0)
@@ -40,7 +41,8 @@ test('Cross-origin redirects clear forbidden headers', async (t) => {
4041
const res = await fetch(`http://localhost:${server2.address().port}`, {
4142
headers: {
4243
Authorization: 'test',
43-
Cookie: 'ddd=dddd'
44+
Cookie: 'ddd=dddd',
45+
'Proxy-Authorization': 'test'
4446
}
4547
})
4648

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy