Skip to content

Commit 876f5eb

Browse files
committed
Validate Location url
1 parent 6694684 commit 876f5eb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/httpClient/httpURLConnectionClient.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,12 @@ class HttpURLConnectionClient implements ClientInterface {
181181
try {
182182
const url = new URL(location);
183183

184+
// allow-list of trusted domains (*.adyen.com)
185+
const allowedHostnameRegex = /^([a-z0-9-]+\.)*adyen\.com$/;
186+
if (!allowedHostnameRegex.test(url.hostname)) {
187+
return reject(new Error(`Redirect to host ${url.hostname} is not allowed.`));
188+
}
189+
184190
const newRequestOptions = {
185191
hostname: url.hostname,
186192
port: url.port || (url.protocol === 'https:' ? 443 : 80),

0 commit comments

Comments
 (0)