Skip to content

Commit

Permalink
chore: strip Authorization header on ws redirect (#29246)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgozman authored Jan 30, 2024
1 parent be6ab76 commit aeafd44
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/playwright-core/src/server/transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,10 @@ export class WebSocketTransport implements ConnectionTransport {
});

if (result.redirect) {
// Strip access key headers from the redirected request.
const newHeaders = Object.fromEntries(Object.entries(headers || {}).filter(([name]) => !name.includes('access-key')));
// Strip authorization headers from the redirected request.
const newHeaders = Object.fromEntries(Object.entries(headers || {}).filter(([name]) => {
return !name.includes('access-key') && name.toLowerCase() !== 'authorization';
}));
return WebSocketTransport._connect(progress, result.redirect.headers.location!, newHeaders, { follow: true, hadRedirects: true }, debugLogHeader);
}

Expand Down

0 comments on commit aeafd44

Please sign in to comment.