Skip to content

Commit b9da3e4

Browse files
authored
Merge pull request from GHSA-3787-6prv-h9w3
Signed-off-by: Matteo Collina <[email protected]>
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

+3
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

+4-2
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)